Skip to content

Single quote for type variables is sometimes intepreted as character literal #3

@tautologico

Description

@tautologico

In some contexts the single quote character for a type variable (e.g. 'T) is interpreted correctly and doesn't change the syntax highlighting, but there are contexts where it is interpreted incorrectly as a character literal, causing the highlighting to extend until the next single quote character. I'm using Sublime 3.0.

An example is the following piece of code:

let coinFlip (p : float) (d1 : Distribution<'T>) (d2 : Distribution<'T>) = 
    if p < 0.0 || p > 1.0 then failwith "invalid probability in coinFlip"
    { new Distribution<'T> with 
          member d.Sample = 
              if rnd.NextDouble() < p then d1.Sample else d2.Sample 
          member d.Support = Set.union d1.Support d2.Support
          member d.Expectation(H) = 
              p * d1.Expectation(H) + (1.0 - p) * d2.Expectation(H) }

The type variables in the first line are interpreted correctly, but the one in the third line causes the rest of the code to be colorized as a character literal.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions