Skip to content

Commit fb767e9

Browse files
T-Groabonie
andauthored
Bugfix - 'static meme x = x' should fail (#16345)
* Make 'static meme' fail as it should * New attempt * Change error message * Update tests/service/SyntaxTreeTests.fs Co-authored-by: Adam Boniecki <[email protected]> --------- Co-authored-by: Adam Boniecki <[email protected]>
1 parent 0368d7d commit fb767e9

18 files changed

+135
-2
lines changed

src/Compiler/FSComp.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1735,4 +1735,5 @@ featureReuseSameFieldsInStructUnions,"Share underlying fields in a [<Struct>] di
17351735
3855,tcNoStaticMemberFoundForOverride,"No static abstract member was found that corresponds to this override"
17361736
3859,tcNoStaticPropertyFoundForOverride,"No static abstract property was found that corresponds to this override"
17371737
3860,chkStaticMembersOnObjectExpressions,"Object expressions cannot implement interfaces with static abstract members or declare static members."
1738-
3861,chkTailCallAttrOnNonRec,"The TailCall attribute should only be applied to recursive functions."
1738+
3861,chkTailCallAttrOnNonRec,"The TailCall attribute should only be applied to recursive functions."
1739+
3862,parsStaticMemberImcompleteSyntax,"Incomplete declaration of a static construct. Use 'static let','static do','static member' or 'static val' for declaration."

src/Compiler/pars.fsy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,6 +1988,9 @@ classDefnMember:
19881988
if Option.isSome $2 then
19891989
errorR (Error (FSComp.SR.parsVisibilityDeclarationsShouldComePriorToIdentifier (), rhs parseState 2))
19901990
let flags = $3
1991+
match flags with
1992+
| _, SynLeadingKeyword.Static(mStatic) -> errorR (Error (FSComp.SR.parsStaticMemberImcompleteSyntax (), mStatic))
1993+
| _ -> ()
19911994
$4 $2 flags $1 rangeStart }
19921995

19931996
| opt_attributes opt_access memberFlags recover

src/Compiler/xlf/FSComp.txt.cs.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compiler/xlf/FSComp.txt.de.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compiler/xlf/FSComp.txt.es.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compiler/xlf/FSComp.txt.fr.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compiler/xlf/FSComp.txt.it.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compiler/xlf/FSComp.txt.ja.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compiler/xlf/FSComp.txt.ko.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Compiler/xlf/FSComp.txt.pl.xlf

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)