Skip to content

Commit 556f28c

Browse files
committed
Revert "disable cosmetic typar overwrite in type extensions"
This reverts commit 15fbf8f.
1 parent 4c3bd64 commit 556f28c

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

src/Compiler/Checking/CheckDeclarations.fs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4220,20 +4220,18 @@ module TcDeclarations =
42204220
| Result res ->
42214221
// Update resolved type parameters with the names from the source.
42224222
let _, tcref, _ = res
4223-
4224-
// Disabled to allow deterministic parallel type checking. See https://github.com/dotnet/fsharp/issues/19033
4225-
// TODO: mutating typar here can lead to a race during parallel type checking.
4226-
// Some type extensions can end up with a wrong type argument name.
4227-
// This will break deterministic builds.
42284223

4229-
//if tcref.TyparsNoRange.Length = synTypars.Length then
4230-
// (tcref.TyparsNoRange, synTypars)
4231-
// ||> List.zip
4232-
// |> List.iter (fun (typar, SynTyparDecl.SynTyparDecl (typar = tp)) ->
4233-
// let (SynTypar(ident = untypedIdent; staticReq = sr)) = tp
4234-
// if typar.StaticReq = sr then
4235-
// typar.SetIdent(untypedIdent)
4236-
// )
4224+
if tcref.TyparsNoRange.Length = synTypars.Length then
4225+
(tcref.TyparsNoRange, synTypars)
4226+
||> List.zip
4227+
|> List.iter (fun (typar, SynTyparDecl.SynTyparDecl (typar = tp)) ->
4228+
let (SynTypar(ident = untypedIdent; staticReq = sr)) = tp
4229+
if typar.StaticReq = sr then
4230+
// TODO: mutating typar here can lead to a race during parallel type checking.
4231+
// Some type extensions can end up with a wrong type argument name.
4232+
// This will break deterministic builds.
4233+
typar.SetIdent(untypedIdent)
4234+
)
42374235

42384236
tcref
42394237

tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ namespace Foo.Types
7676
7777
val EndColumn: int"""
7878

79-
// See https://github.com/dotnet/fsharp/issues/19033
80-
[<Fact(Skip="needs fixing")>]
79+
[<Fact>]
8180
let ``Type extension uses type parameters names from source`` () =
8281
FSharp """
8382
module Extensions
@@ -94,8 +93,7 @@ type List<'E> with
9493
9594
member X: 'E"""
9695

97-
// See https://github.com/dotnet/fsharp/issues/19033
98-
[<Fact(Skip="needs fixing")>]
96+
[<Fact>]
9997
let ``Type extension with constraints uses type parameters names from source`` () =
10098
FSharp """
10199
module Extensions
@@ -112,8 +110,7 @@ type Map<'K,'V when 'K: comparison> with
112110
113111
member X: t: 'T -> k: 'K -> 'K option * ({| n: 'K array |} * int) when 'K: comparison"""
114112

115-
// See https://github.com/dotnet/fsharp/issues/19033
116-
[<Fact(Skip="needs fixing")>]
113+
[<Fact>]
117114
let ``Type extension with lowercase type parameters names from source`` () =
118115
FSharp """
119116
module Extensions

0 commit comments

Comments
 (0)