-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Do not flag match types as Deferred
and amend #20077
#20147
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
File renamed without changes.
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,13 @@ | ||
|
||
trait Scope | ||
object Scope: | ||
given i: Int = ??? | ||
|
||
type ReferencesScope[S] >: Int <: Int | ||
|
||
type ScopeToInt[Why] = Why match | ||
case Scope => Int | ||
|
||
def foo[T](using d: ReferencesScope[T]): Any = ??? | ||
|
||
def bar[T](using d: ScopeToInt[T]): Any = ??? |
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,8 @@ | ||
|
||
def test: Unit = | ||
foo[Scope] // ok | ||
bar[Scope] // error | ||
|
||
import Scope.i | ||
bar[Scope] // ok | ||
|
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,14 @@ | ||
|
||
trait Expr: | ||
type Value | ||
object Expr: | ||
type Of[V] = Expr { type Value = V } | ||
type ExtractValue[E <: Expr] = E match | ||
case Expr.Of[v] => v | ||
|
||
trait TC[E <: Expr]: | ||
type Elem = Expr.ExtractValue[E] | ||
class BIExpr extends Expr: | ||
type Value = BigInt | ||
class Foo extends TC[BIExpr]: | ||
val v: Elem = 0 |
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,8 @@ | ||
package a | ||
|
||
trait Expr: | ||
type Value | ||
object Expr: | ||
type Of[V] = Expr { type Value = V } | ||
type ExtractValue[E <: Expr] = E match | ||
case Expr.Of[v] => v |
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,8 @@ | ||
package a | ||
|
||
trait TC[E <: Expr]: | ||
type Elem = Expr.ExtractValue[E] | ||
class BIExpr extends Expr: | ||
type Value = BigInt | ||
class Foo extends TC[BIExpr]: | ||
val v: Elem = 0 |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this change is correct. #19871 is about making aliases to an applied type, even if that is backed by a match type, be a TypeAlias rather than a MatchAlias.
What we're dealing with here is a straight alias to a match type, except the match type immediately normalises to a non-match type. When compiling from source we simplify it and thus give the alias a TypeAlias. With this change, when we're unpickling we also simplify and thus give the alias a TypeAlias.
If you can find a clearer way to express that, we should keep this information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I agree this shouldn't be impacted by the changes in #19871.
But I'm now not sure about which cases get reduced more from the Unpickler than when from the Typer ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing more. The point is the have the same definition, whether from source code or from tasty, have the same info, so that differences in MatchAlias and TypeAlias don't become a factor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So assuming the match type reduces to non match type, won't they all have a TypeAlias now ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, but only because I added
overwriteType
here. The deleted comment is part of (attempting to!) explain that and shouldn't have been removed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so I agree we need
tpt.overwriteType(tpt.tpe.normalized)
and that it is becausethat's what Typer does
.Still, it was my understanding that the Typer and Unpickler now use AliasingBounds in a consistent way, so I don't understand how there is a
difference here
forthe TypeRef for that definition
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By "The difference here" I meant "The reason that is important to do is because..."