diff --git a/.gitignore b/.gitignore index cbf6773ddd1..607a5695e34 100644 --- a/.gitignore +++ b/.gitignore @@ -125,3 +125,4 @@ tests/fsharpqa/testenv/bin/System.ValueTuple.dll msbuild.binlog /fcs/FSharp.Compiler.Service.netstandard/*.fs /fcs/FSharp.Compiler.Service.netstandard/*.fsi +.idea/ diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 63324554f1c..2e94ac16e04 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1458,3 +1458,4 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3245,tcCopyAndUpdateNeedsRecordType,"The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record" 3300,chkInvalidFunctionParameterType,"The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL." 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." +3302,parsEqualsMissingInTypeDefinition,"Unexpected symbol '{' in type definition. Did you forget to use the = operator?" diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 52bbef6d05a..45962313549 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -1441,8 +1441,10 @@ tyconDefn: | typeNameInfo { TypeDefn($1,SynTypeDefnRepr.Simple(SynTypeDefnSimpleRepr.None($1.Range),$1.Range),[],$1.Range) } - | typeNameInfo EQUALS tyconDefnRhsBlock - { let nameRange = rhs parseState 1 + | typeNameInfo opt_EQUALS tyconDefnRhsBlock + { + if Option.isNone $2 then raiseParseErrorAt (rhs parseState 1) (FSComp.SR.parsEqualsMissingInTypeDefinition()) + let nameRange = rhs parseState 1 let (tcDefRepr:SynTypeDefnRepr),members = $3 nameRange let declRange = unionRanges (rhs parseState 1) tcDefRepr.Range let mWhole = (declRange, members) ||> unionRangeWithListBy (fun (mem:SynMemberDefn) -> mem.Range) @@ -4935,6 +4937,10 @@ deprecated_opt_equals: | EQUALS { deprecatedWithError (FSComp.SR.parsNoEqualShouldFollowNamespace()) (lhs parseState); () } | /* EMPTY */ { } +opt_EQUALS: + | EQUALS { } + | /* EMPTY */ { } + opt_OBLOCKSEP: | OBLOCKSEP { } | /* EMPTY */ { }