diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 5c87eb88b88..35f5fd6bbc3 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -49,6 +49,7 @@ * Fix signature generation: type params with special characters missing backtick escaping. ([Issue #19595](https://github.com/dotnet/fsharp/issues/19595), [PR #19609](https://github.com/dotnet/fsharp/pull/19609)) * Fix internal error when using custom attribute with `[]` value type parameter and no `[]`. ([Issue #8353](https://github.com/dotnet/fsharp/issues/8353), [PR #19484](https://github.com/dotnet/fsharp/pull/19484)) * Fix parallel compilation of scripts ([PR #19649](https://github.com/dotnet/fsharp/pull/19649)) +* Parser: fix unexpected diagnostics in debug builds, improve error messages ([PR #19730](https://github.com/dotnet/fsharp/pull/19730)) ### Added diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index 7a9d93facac..4ecbfc081ef 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -497,6 +497,8 @@ module OldStyleMessages = let NONTERM_classDefnMemberE () = Message("NONTERM.classDefnMember", "") let NONTERM_defnBindingsE () = Message("NONTERM.defnBindings", "") let NONTERM_classMemberSpfnE () = Message("NONTERM.classMemberSpfn", "") + let NONTERM_classMemberSpfnGetSetElementsE () = Message("NONTERM.classMemberSpfnGetSetElements", "") + let NONTERM_autoPropsDefnDeclE () = Message("NONTERM.autoPropsDefnDecl", "") let NONTERM_valSpfnE () = Message("NONTERM.valSpfn", "") let NONTERM_tyconSpfnE () = Message("NONTERM.tyconSpfn", "") let NONTERM_anonLambdaExprE () = Message("NONTERM.anonLambdaExpr", "") @@ -1470,6 +1472,12 @@ type Exception with | [ Parser.NONTERM_classMemberSpfn ] -> os.AppendString(NONTERM_classMemberSpfnE().Format) true + | [ Parser.NONTERM_classMemberSpfnGetSetElements ] -> + os.AppendString(NONTERM_classMemberSpfnGetSetElementsE().Format) + true + | [ Parser.NONTERM_autoPropsDefnDecl ] -> + os.AppendString(NONTERM_autoPropsDefnDeclE().Format) + true | [ Parser.NONTERM_valSpfn ] -> os.AppendString(NONTERM_valSpfnE().Format) true diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx index 2783a569fdb..920cc48a52a 100644 --- a/src/Compiler/FSStrings.resx +++ b/src/Compiler/FSStrings.resx @@ -788,6 +788,12 @@ in member signature + + + in property definition + + + in auto property definition in value signature diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index 30003ecc155..a28784716d6 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index b04b50a630d..73299495a4b 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index de6c7a3e4ca..e73ce8e4291 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index d01331484cb..cb784fdab67 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 4721867dc6b..de6c619667a 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index d9d94d47fae..23154e99892 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index be61bd88fcb..8b2e15d5d5f 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index f3c19eb815b..7ab2fe2d494 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index 40fb1f2305f..f5e8bc53ca4 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 95ae50b60fd..117c522a187 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index 9da12dfe721..6483eba2da0 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index c9fda977784..be48009ccde 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index a199691702d..45cae27f445 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -67,6 +67,16 @@ This attribute is not valid for use on this language element + + in auto property definition + in auto property definition + + + + in property definition + in property definition + + No constructors are available for the type '{0}' No constructors are available for the type '{0}' diff --git a/tests/service/data/SyntaxTree/Member/Abstract - Property 03.fs.bsl b/tests/service/data/SyntaxTree/Member/Abstract - Property 03.fs.bsl index cff1499dca4..2ac250de233 100644 --- a/tests/service/data/SyntaxTree/Member/Abstract - Property 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Abstract - Property 03.fs.bsl @@ -45,4 +45,4 @@ ImplFile (6,0)-(6,1) parse error Unexpected syntax or possible incorrect indentation: this token is offside of context started at position (4:5). Try indenting this further. To continue using non-conforming indentation, pass the '--strict-indentation-' flag to the compiler, or set the language version to F# 7. -(6,0)-(6,1) parse error Incomplete structured construct at or before this point in member definition. Expected identifier, '(', '(*)' or other token. +(6,0)-(6,1) parse error Incomplete structured construct at or before this point in property definition. Expected identifier, '(', '(*)' or other token. diff --git a/tests/service/data/SyntaxTree/Member/Auto property 05.fs.bsl b/tests/service/data/SyntaxTree/Member/Auto property 05.fs.bsl index 6ae271aaa1a..3966f6f7abd 100644 --- a/tests/service/data/SyntaxTree/Member/Auto property 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Auto property 05.fs.bsl @@ -66,4 +66,4 @@ ImplFile WarnDirectives = [] CodeComments = [] }, set [])) -(4,15)-(5,4) parse error Incomplete structured construct at or before this point in member definition. Expected identifier or other token. +(4,15)-(5,4) parse error Incomplete structured construct at or before this point in auto property definition. Expected identifier or other token. diff --git a/tests/service/data/SyntaxTree/Member/Auto property 06.fs.bsl b/tests/service/data/SyntaxTree/Member/Auto property 06.fs.bsl index 4e0c9d821ae..1828615632b 100644 --- a/tests/service/data/SyntaxTree/Member/Auto property 06.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Auto property 06.fs.bsl @@ -43,4 +43,4 @@ ImplFile WarnDirectives = [] CodeComments = [] }, set [])) -(4,18)-(4,19) parse error Unexpected symbol '=' in member definition +(4,18)-(4,19) parse error Unexpected symbol '=' in auto property definition diff --git a/tests/service/data/SyntaxTree/Member/Auto property 08.fs.bsl b/tests/service/data/SyntaxTree/Member/Auto property 08.fs.bsl index c758fcae4a9..eff63393708 100644 --- a/tests/service/data/SyntaxTree/Member/Auto property 08.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Auto property 08.fs.bsl @@ -46,4 +46,4 @@ ImplFile (6,0)-(6,1) parse error Unexpected syntax or possible incorrect indentation: this token is offside of context started at position (4:22). Try indenting this further. To continue using non-conforming indentation, pass the '--strict-indentation-' flag to the compiler, or set the language version to F# 7. -(6,0)-(6,1) parse error Incomplete structured construct at or before this point. Expected identifier, '(', '(*)' or other token. +(6,0)-(6,1) parse error Incomplete structured construct at or before this point in property definition. Expected identifier, '(', '(*)' or other token. diff --git a/tests/service/data/SyntaxTree/Member/Auto property 09.fs.bsl b/tests/service/data/SyntaxTree/Member/Auto property 09.fs.bsl index 70796107bed..cbb94cfd556 100644 --- a/tests/service/data/SyntaxTree/Member/Auto property 09.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Auto property 09.fs.bsl @@ -69,4 +69,4 @@ ImplFile (5,4)-(5,10) parse error Unexpected syntax or possible incorrect indentation: this token is offside of context started at position (4:23). Try indenting this further. To continue using non-conforming indentation, pass the '--strict-indentation-' flag to the compiler, or set the language version to F# 7. -(5,4)-(5,10) parse error Incomplete structured construct at or before this point. Expected identifier, '(', '(*)' or other token. +(5,4)-(5,10) parse error Incomplete structured construct at or before this point in property definition. Expected identifier, '(', '(*)' or other token. diff --git a/tests/service/data/SyntaxTree/Member/Auto property 10.fs.bsl b/tests/service/data/SyntaxTree/Member/Auto property 10.fs.bsl index ba04b1a3de7..faddd5d4fdd 100644 --- a/tests/service/data/SyntaxTree/Member/Auto property 10.fs.bsl +++ b/tests/service/data/SyntaxTree/Member/Auto property 10.fs.bsl @@ -45,4 +45,4 @@ ImplFile (5,0)-(5,0) parse error Unexpected syntax or possible incorrect indentation: this token is offside of context started at position (4:22). Try indenting this further. To continue using non-conforming indentation, pass the '--strict-indentation-' flag to the compiler, or set the language version to F# 7. -(5,0)-(5,0) parse error Incomplete structured construct at or before this point. Expected identifier, '(', '(*)' or other token. +(5,0)-(5,0) parse error Incomplete structured construct at or before this point in property definition. Expected identifier, '(', '(*)' or other token.