File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed
tests/FSharp.Compiler.ComponentTests Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 277277 <Compile Include =" Interop\Literals.fs" />
278278 <Compile Include =" Scripting\Interactive.fs" />
279279 <Compile Include =" Scripting\TypeCheckOnlyTests.fs" />
280+ <Compile Include =" TypeChecks\TypeRelations.fs" />
280281 <Compile Include =" TypeChecks\SeqTypeCheckTests.fs" />
281282 <Compile Include =" TypeChecks\CheckDeclarationsTests.fs" />
282283 <Compile Include =" TypeChecks\Graph\Utils.fs" />
Original file line number Diff line number Diff line change 1+ module MyModule
2+
3+ type IFoo < 'T when 'T :> IFoo < 'T >> =
4+ abstract member Bar: other : 'T -> unit
5+
6+ [<AbstractClass>]
7+ type FooBase () =
8+
9+ interface IFoo< FooBase> with
10+ member this.Bar ( other : FooBase ) = ()
11+
12+ [<Sealed>]
13+ type FooDerived < 'T >() =
14+ inherit FooBase()
15+
16+ interface IFoo< FooDerived< 'T>> with
17+ member this.Bar other = ()
18+
19+ type IFooContainer < 'T > =
20+ abstract member Foo: FooDerived < 'T >
21+
22+ let inline bar < 'a when 'a :> IFoo < 'a >> ( x : 'a ) ( y : 'a ) = x.Bar y
23+ let inline takeSame < 'a > ( x : 'a ) ( y : 'a ) = ()
24+
25+ // Successfully compiles under .NET 9 + F# 9
26+ // Error under .NET 10 + F# 10: Program.fs(26,13): Error FS0193 : The type 'FooDerived<'TId>' does not match the type 'FooBase'
27+ let callBar_NewlyBroken ( foo1 : IFooContainer < 'TId >) ( foo2 : IFooContainer < 'TId >) =
28+ bar foo1.Foo foo2.Foo
29+
30+ // Successfully compiles under both versions
31+ let callBar ( foo1 : IFooContainer < 'TId >) ( foo2 : IFooContainer < 'TId >) =
32+ let id1 = foo1.Foo
33+ let id2 = foo2.Foo
34+ bar id1 id2
Original file line number Diff line number Diff line change 1+ module TypeChecks.TypeRelations
2+
3+ open Xunit
4+ open FSharp.Test .Compiler
5+ open FSharp.Test
6+
7+ [<Theory; FileInlineData( " CrgpLibrary.fs" ) >]
8+ let ``Unsolved type variables are not cached`` compilation =
9+ compilation
10+ |> getCompilation
11+ |> typecheck
12+ |> shouldSucceed
You can’t perform that action at this time.
0 commit comments