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
instantiate gets confused if tvar is inferred to be a refinement type whose parent is a refinement type #5829
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5829?orig=1 |
@xeno-by said (edited on May 24, 2012 12:35:39 AM UTC): Test.universe.RefTree with Test.universe.SymTree with Test.universe.NameTree Mapping over this type goes into: case rtp @ RefinedType(parents, decls) =>
val parents1 = parents mapConserve this
val decls1 = mapOver(decls)
//if ((parents1 eq parents) && (decls1 eq decls)) tp
//else refinementOfClass(tp.typeSymbol, parents1, decls1)
copyRefinedType(rtp, parents1, decls1)
Test.universe.RefTree // TypeRef(pre = Test.universe.type, sym = type RefTree /* AbstractTypeSymbol */, args = Nil)
Test.universe.SymTree with Test.universe.NameTree // RefinementTypeRef (pre = NoType, sym = Universe /* RefinementClassSymbol */, args = Nil)
object instantiate extends TypeMap {
private var excludedVars = immutable.Set[TypeVar]()
def apply(tp: Type): Type = tp match {
case WildcardType | BoundedWildcardType(_) | NoType =>
throw new NoInstance("undetermined type")
case tv @ TypeVar(origin, constr) if !tv.untouchable =>
if (constr.inst == NoType) {
throw new DeferredNoInstance(() =>
"no unique instantiation of type variable " + origin + " could be found")
} else if (excludedVars(tv)) {
throw new NoInstance("cyclic instantiation")
} else {
excludedVars += tv
val res = apply(constr.inst)
excludedVars -= tv
res
}
case _ =>
mapOver(tp)
}
} When navigating the second parent, |
@xeno-by said (edited on May 24, 2012 6:28:03 AM UTC): List(Test.universe.RefTree, Test.universe.SymTree with Test.universe.NameTree) But not just to: List(Test.universe.RefTree) (the latter is how things work with concrete types) |
@adriaanm said: This issue is an example of where the prefix is something interesting, and not just good old fix in https://github.com/adriaanm/scala/tree/ticket/5829 pending it passing the test suite |
@xeno-by said: |
@paulp said: For the record, and maybe you know this because you say "prefix is something interesting" which sounds like a reference to the comment, but I did this because it was documented by martin that "refinements always have non-interesting prefixes." |
The text was updated successfully, but these errors were encountered: