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
Denotation#signature: take the "Java-ness" of the prefix into account
When comparing denotations using Denotation#matches, we check if they
have matching signatures, but this could return false when comparing a
Java and non-Java methods which can happen when doing overriding checks.
Override checks are done as seen from some common prefix, but
`asSeenFrom` does not change the Java-ness of a method (that is, change
the result of MethodType#isJavaMethod). We could change `asSeenFrom` to
do that, but that would be pretty expensive in terms of allocation.
Instead, we change SingleDenotation#signature to rely on the prefix of
the current denotation to decide how to compute its signature. This
requires adding a special-case in SingleDenotation#computeAsSeenFrom to
ensure that the prefix is always available when we need it to compute
the Java-ness of a denotation.
Note that even after this change, we cannot simply override a Java
generic `Array[T]` with a Scala `Array[T]`, because we intentionally
parse these Java types as `Array[T & Object]`, see
`TypeApplications.translateJavaArrayElementType` for details and
tests/{neg,pos}/i1747.scala for examples.
0 commit comments