You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Out of curiosity I wanted to know whether this happened in VS2015 as well. The error is a bit clearer (i.e., not on the equal-sign, but on the whole constructor), however still not very helpful:
Btw, I cannot repro the "unexpected symbol" error, I receive this (15.7 Update 2):
The correct thing is always to use new (arg) = .... Parentheses are required here.
My reply on fsharp/fsharp:
@ChrSteinert This is a parser thing where it is thinking new c is an expression, e.g. new Object(). In the first line it is not seen as ambiguous because there is no possibility of an expression at that point in the syntax (it's one of the only points where that's not possible).
We could give a warning since I can see how you could hit this. The warning would ask the user to write new (arg1, ... argN) in constructor definitions, always using parentheses.
Originally from here: fsharp/fsharp#827
When adding constructors to to an F# class the required syntax changes, e.g. is different for the last constructor (for single parameter
.ctor
s).Repro steps
While the following code is valid…
… adding another
.ctor
with one parameter in a similar fashion does not validate anymore:The error on the
=
on the third line is:error FS0010: Unexpected symbol '=' in expression
Known workarounds
Parameters of the not-last
.ctor
must be wrapped in braces. For a yet bigger example this gives:(Also omitting the first brace (in
new (a)
) does break the thing.)Related information
Observed on Win 10 in VS and Ionide with latest releases installed.
Severity is most probably low.
The text was updated successfully, but these errors were encountered: