-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #6588: Dealias inferred quoted types #6599
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
Conversation
def synthesizedTypeTag(formal: Type): Tree = { | ||
def quotedType(t: Type) = { | ||
if (StagingContext.level == 0) | ||
ctx.compilationUnit.needsStaging = true // We will need to run ReifyQuotes | ||
ref(defn.InternalQuoted_typeQuote).appliedToType(t) | ||
} | ||
formal.argInfos match { | ||
case arg :: Nil if !arg.typeSymbol.is(Param) => | ||
object bindFreeVars extends TypeMap { |
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.
This TypeMap
is completely useless here. This is already performed by the PCP check in the Staging
phase which emits errors with extra level information if the implicit is not found.
foo[V] | ||
|
||
type B = V => T | ||
foo[B] |
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.
The code generated for the type tags is now
def main: Int =
{
type S = Int
{
val evidence$1: quoted.Type[Int] = scala.quoted.Type.IntTag
10:Int
}
{
val evidence$1: quoted.Type[Int] = scala.quoted.Type.IntTag
10:Int
}
type T = Function1[Int, Int]
{
val evidence$1: quoted.Type[Int => Int] = '[Int => Int]
10:Int
}
{
val evidence$1: quoted.Type[Int => Int] = '[Int => Int]
10:Int
}
type U = List[Int]
{
val evidence$1: quoted.Type[List[Int]] = '[List[Int]]
10:Int
}
{
val evidence$1: quoted.Type[List[Int]] = '[List[Int]]
10:Int
}
type N = List
{
val evidence$1: quoted.Type[List] = '[List]
10:Int
}
{
val evidence$1: quoted.Type[List] = '[List]
10:Int
}
type V = List[S]
{
val evidence$1: quoted.Type[List[Int]] = '[List[Int]]
10:Int
}
type B = Function1[V, T]
{
val evidence$1: quoted.Type[List[Int] => Int => Int] =
'[List[Int] => Int => Int]
10:Int
}
}
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.
After the second commit, we get
...
type V = List[S]
{
10:Int
}
type B = Function1[V, T]
{
10:Int
}
@@ -388,7 +388,7 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] => | |||
case New(_) | Closure(_, _, _) => | |||
Pure | |||
case TypeApply(fn, _) => | |||
if (fn.symbol.is(Erased)) Pure else exprPurity(fn) | |||
if (fn.symbol.is(Erased) || fn.symbol == defn.InternalQuoted_typeQuote) Pure else exprPurity(fn) |
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.
It would be good if we could find a more systematic way to do this. Ideally, we could mark typeQuote
to be a pure function. We have a flag for that (it's StableRealizable
), but so far this cannot be set from source.
Maybe leave a TODO that we should do the change.
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.
Should we have some internal flag to mark those methods?
Rebased |
No description provided.