Skip to content

Type.matches is still incomplete #814

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

Closed
DarkDimius opened this issue Oct 1, 2015 · 2 comments
Closed

Type.matches is still incomplete #814

DarkDimius opened this issue Oct 1, 2015 · 2 comments

Comments

@DarkDimius
Copy link
Contributor

ListBuffer += does not match Growable += before erasure.
Here are their types:

ListBuffer.+= MethodType(List(xs), List(RefinedType(TypeRef(ThisType(TypeRef(NoPrefix,collection)),TraversableOnce), scala$collection$TraversableOnce$$A, TypeAlias(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,mutable)),ListBuffer)),scala$collection$mutable$ListBuffer$$A)) | -1582256965)), 
/*returnType*/ ThisType(TypeRef(ThisType(TypeRef(NoPrefix,mutable)),ListBuffer)))

Growable  .+= MethodType(List(xs), List(RefinedType(TypeRef(ThisType(TypeRef(NoPrefix,collection)),TraversableOnce), scala$collection$TraversableOnce$$A, TypeAlias(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,generic)),Growable)),scala$collection$generic$Growable$$A)) | 607071156)), 
/*returnType*/ ThisType(TypeRef(ThisType(TypeRef(NoPrefix,generic)),Growable)))

matchingParams for those types is false, and the only thing that is different is type aliases inside.
Note that ListBuffer[A] extends Builder[A, List[A]], and Builder[A, List[A]] extends Growable[A], so I guess those type aliases should be considered =:=

@DarkDimius
Copy link
Contributor Author

Maybe has to do with #813, as there we have

class GenericCompanion[+CC[X] <: GenTraversable[X]] {
    protected[this] type Coll = CC[_]
}

class GenTraversableFactory[CC[X] <: GenTraversable[X] with GenericTraversableTemplate[X, CC]]
extends GenericCompanion[CC] {
// Dotty does not consider Coll as a subtype of GenericTraversableTemplate here
// Scalac does
}

@DarkDimius
Copy link
Contributor Author

My bad. I need to use asSeenFrom before comparing the types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant