-
Notifications
You must be signed in to change notification settings - Fork 833
Type subsumption cache: handle unsolved type vars #19040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
majocha
wants to merge
16
commits into
dotnet:main
Choose a base branch
from
majocha:fix-unsolved
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+180
−64
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e3d1871
add test
majocha aec47e7
release notes
majocha b4b951c
for unsolved always recompute TypeStructure
majocha 0939fba
nit
majocha ad681fa
Merge branch 'main' into fix-unsolved
majocha 5f86502
wip
majocha 068b3b5
emit stamps for constrained vars only
majocha 25357f8
TType_app only
majocha 73c80ff
merge main
majocha e22f124
memoize only stable structures
majocha 5065dc7
Merge branch 'main' into fix-unsolved
majocha 105e9aa
omfg
majocha cb423e5
do not weakly memoize when typars are involved, ignore nullness
majocha 9c5037a
merge main
majocha 95711be
Merge branch 'main' into fix-unsolved
majocha 7272e64
Merge branch 'main' into fix-unsolved
majocha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/FSharp.Compiler.ComponentTests/TypeChecks/CrgpLibrary.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| module MyModule | ||
|
|
||
| type IFoo<'T when 'T :> IFoo<'T>> = | ||
| abstract member Bar: other:'T -> unit | ||
|
|
||
| [<AbstractClass>] | ||
| type FooBase() = | ||
|
|
||
| interface IFoo<FooBase> with | ||
| member this.Bar (other: FooBase) = () | ||
|
|
||
| [<Sealed>] | ||
| type FooDerived<'T>() = | ||
| inherit FooBase() | ||
|
|
||
| interface IFoo<FooDerived<'T>> with | ||
| member this.Bar other = () | ||
|
|
||
| type IFooContainer<'T> = | ||
| abstract member Foo: FooDerived<'T> | ||
|
|
||
| let inline bar<'a when 'a :> IFoo<'a>> (x: 'a) (y: 'a) = x.Bar y | ||
| let inline takeSame<'a> (x: 'a) (y: 'a) = () | ||
|
|
||
| // Successfully compiles under .NET 9 + F# 9 | ||
| // Error under .NET 10 + F# 10: Program.fs(26,13): Error FS0193 : The type 'FooDerived<'TId>' does not match the type 'FooBase' | ||
| let callBar_NewlyBroken (foo1: IFooContainer<'TId>) (foo2: IFooContainer<'TId>) = | ||
| bar foo1.Foo foo2.Foo | ||
|
|
||
| // Successfully compiles under both versions | ||
| let callBar (foo1: IFooContainer<'TId>) (foo2: IFooContainer<'TId>) = | ||
| let id1 = foo1.Foo | ||
| let id2 = foo2.Foo | ||
| bar id1 id2 |
12 changes: 12 additions & 0 deletions
12
tests/FSharp.Compiler.ComponentTests/TypeChecks/TypeRelations.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| module TypeChecks.TypeRelations | ||
|
|
||
| open Xunit | ||
| open FSharp.Test.Compiler | ||
| open FSharp.Test | ||
|
|
||
| [<Theory; FileInlineData("CrgpLibrary.fs")>] | ||
| let ``Unsolved type variables are not cached`` compilation = | ||
| compilation | ||
| |> getCompilation | ||
| |> typecheck | ||
| |> shouldSucceed |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.