Consider the following code and AST:
[<Measure>] type herth = / second
// Same AST
[<Measure>] type herth = 1 / second
AST:
Types
([SynTypeDefn
(SynComponentInfo
([{ Attributes = [ ... ], None, [], [herth],
PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector),
false, None, tmp.fsx (1,17--1,22)),
Simple
(TypeAbbrev
(Ok,
Tuple
(false,
[(true,
StaticConstant (Int32 1, tmp.fsx (1,25--1,33)));
(false,
LongIdent (SynLongIdent ([second], [], [None])))], ...]
Types
([SynTypeDefn
(SynComponentInfo
([{ Attributes = [ ... ]
Range = tmp.fsx (3,0--3,11) }], None, [], [herth],
PreXmlDoc ((3,0), FSharp.Compiler.Xml.XmlDocCollector),
false, None, tmp.fsx (3,17--3,22)),
Simple
(TypeAbbrev
(Ok,
Tuple
(false,
[(true,
StaticConstant (Int32 1, tmp.fsx (3,25--3,26)));
(false,
LongIdent (SynLongIdent ([second], [], [None])))],... ], tmp.fsx (3,0--3,35))
Expected behaviour
The AST should be different, there is no actual 1 in / second.
Actual behaviour
I noticed a shortcut in:
|
| INFIX_STAR_DIV_MOD_OP tupleOrQuotTypeElements |
|
{ if $1 <> "/" then reportParseErrorAt (rhs parseState 1) (FSComp.SR.parsUnexpectedInfixOperator()); |
|
SynType.Tuple(false, (true, SynType.StaticConstant (SynConst.Int32 1, lhs parseState)) :: $2, lhs parseState) } |
Perhaps we need a new case for this in SynType.
I'm not quite sure if SynType.Tuple is quite correct to capture a / b in the first place.
How should this be modelled? Any Ideas @dsyme and @auduchinok?
//cc @edgarfgp
Consider the following code and AST:
AST:
Expected behaviour
The AST should be different, there is no actual
1in/ second.Actual behaviour
I noticed a shortcut in:
fsharp/src/Compiler/pars.fsy
Lines 5253 to 5255 in 4be3bb5
Perhaps we need a new case for this in SynType.
I'm not quite sure if
SynType.Tupleis quite correct to capturea / bin the first place.How should this be modelled? Any Ideas @dsyme and @auduchinok?
//cc @edgarfgp