You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sym.info may still change indirectly, when sym.info.typeSymbol.info ne this(sym.info.typeSymbol.info)
It turns out it's more than an optimization, as simply setting it to false causes other problems.
repro:
// derived from a real-world Slick app (support #3035)// running Test should not throw a java.lang.ClassFormatError: Duplicate method name&signature in class file Test$$anonfun$1 // workaround: uncomment type arg to list belowclassAbstractTable[T] { typeTableElementType }
classTable[T] extendsAbstractTable[T] { typeTableElementType=T }
classQuery[E, U]
classTableQuery[E<:AbstractTable[_]] extendsQuery[E, E#TableElementType]
objectTestextendsApp {
objectMyTableextendsTableQuery[Table[Long]]
deflist[R](q: Query[_, R]):List[R] =Nil
list/*[Long]*/(MyTable) collect { case x => x }
}
The text was updated successfully, but these errors were encountered:
@retronym said:
Here's a (contrived) TypeMap that might help this discussion. It tries, in one pass, to substitute Longs for Ints and type parameters with their upper bounds:
scala> object map extends TypeMap {
def apply(tp: Type) = tp match {
case TypeRef(pre, sym, args) if sym == IntClass => LongClass.tpe
case TypeRef(_, sym, args) if sym.isTypeParameter => mapOver(tp.bounds.hi)
case x => mapOver(x)
}
}
defined object map
scala> trait T { def m[A <: Int](a: A) }
defined trait T
scala> val m = typeOf[T].member(TermName("m"))
m: $r.intp.global.Symbol = method m
scala> map(m.info)
res31: $r.intp.global.Type = [A <: Long](a: Int)Unit
We could substitute tparams -> tparams1 in result before applying the TypeMap to make this work. But I'm not sure thats the right thing to do.
In TypeMap, the following optimization is too eager:
sym.info
may still change indirectly, whensym.info.typeSymbol.info ne this(sym.info.typeSymbol.info)
It turns out it's more than an optimization, as simply setting it to false causes other problems.
repro:
The text was updated successfully, but these errors were encountered: