Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
Fixed Literal value in signature (dotnet#7901)
Browse files Browse the repository at this point in the history
* Fixed literal sig from breaking subsequent sigs

* Added tests for literal sig

* Fixed test

* Fixed test name
  • Loading branch information
TIHan authored and nosami committed Feb 22, 2021
1 parent a872771 commit 754a398
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fsharp/pars.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ optLiteralValueSpfn:
| EQUALS declExpr
{ Some($2) }

| EQUALS OBLOCKBEGIN declExpr oblockend
| EQUALS OBLOCKBEGIN declExpr oblockend opt_ODECLEND
{ Some($3) }


Expand Down
6 changes: 6 additions & 0 deletions tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,12 @@ module TypecheckTests =
fsc cfg "%s --target:library -o:pos32.dll --warnaserror" cfg.fsc_flags ["pos32.fs"]
peverify cfg "pos32.dll"

[<Test>]
let ``sigs pos33`` () =
let cfg = testConfig "typecheck/sigs"
fsc cfg "%s --target:library -o:pos33.dll --warnaserror" cfg.fsc_flags ["pos33.fsi"; "pos33.fs"]
peverify cfg "pos33.dll"

[<Test>]
let ``sigs pos23`` () =
let cfg = testConfig "typecheck/sigs"
Expand Down
11 changes: 11 additions & 0 deletions tests/fsharp/typecheck/sigs/pos33.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Pos33

let x = 1
[<Literal>]
let y = 1
let z = 1
[<Literal>]
let w = "w"
let q = "q"
[<Literal>]
let u = "u"
12 changes: 12 additions & 0 deletions tests/fsharp/typecheck/sigs/pos33.fsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Pos33

val x : int
[<Literal>]
val y : int = 1
val z : int
[<Literal>]
val w : string = "w"
val q : string
[<Literal>]
val u : string =
"u"

0 comments on commit 754a398

Please sign in to comment.