Skip to content

Commit bd667c5

Browse files
TIHancartermp
authored andcommitted
Fixed Literal value in signature (#7901)
* Fixed literal sig from breaking subsequent sigs * Added tests for literal sig * Fixed test * Fixed test name
1 parent acafb50 commit bd667c5

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

src/fsharp/pars.fsy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ optLiteralValueSpfn:
788788
| EQUALS declExpr
789789
{ Some($2) }
790790

791-
| EQUALS OBLOCKBEGIN declExpr oblockend
791+
| EQUALS OBLOCKBEGIN declExpr oblockend opt_ODECLEND
792792
{ Some($3) }
793793

794794

tests/fsharp/tests.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,6 +2155,12 @@ module TypecheckTests =
21552155
fsc cfg "%s --target:library -o:pos32.dll --warnaserror" cfg.fsc_flags ["pos32.fs"]
21562156
peverify cfg "pos32.dll"
21572157

2158+
[<Test>]
2159+
let ``sigs pos33`` () =
2160+
let cfg = testConfig "typecheck/sigs"
2161+
fsc cfg "%s --target:library -o:pos33.dll --warnaserror" cfg.fsc_flags ["pos33.fsi"; "pos33.fs"]
2162+
peverify cfg "pos33.dll"
2163+
21582164
[<Test>]
21592165
let ``sigs pos23`` () =
21602166
let cfg = testConfig "typecheck/sigs"

tests/fsharp/typecheck/sigs/pos33.fs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module Pos33
2+
3+
let x = 1
4+
[<Literal>]
5+
let y = 1
6+
let z = 1
7+
[<Literal>]
8+
let w = "w"
9+
let q = "q"
10+
[<Literal>]
11+
let u = "u"

tests/fsharp/typecheck/sigs/pos33.fsi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module Pos33
2+
3+
val x : int
4+
[<Literal>]
5+
val y : int = 1
6+
val z : int
7+
[<Literal>]
8+
val w : string = "w"
9+
val q : string
10+
[<Literal>]
11+
val u : string =
12+
"u"

0 commit comments

Comments
 (0)