Fix supertypes consistency check

See testKt5508:
`inner class B<S> : A<B<S>>()` is effectively the same as
`A<T>.B<S> : A<A<T>.B<S>>` or `B<S, T> : A<B<S, T>>`.
The latter is because we add outer class parameters to inner type constructor.

The problem is that we treat type constructors of first TP of 'A'
and of second type parameter (copy) of 'B' just the same and report INCONSISTENT_TYPE_PARAMETER_VALUES.

So we supposse it's more correct to compare type parameter descriptors instead
This commit is contained in:
Denis Zharkov
2015-11-06 12:06:01 +03:00
parent 188bcf0a03
commit daed74f9b2
3 changed files with 12 additions and 15 deletions
@@ -526,7 +526,7 @@ public class SignaturesPropagationData {
// #1 of Baz -> A
// #0 of Foo -> A (mapped to itself)
// #1 of Foo -> B (mapped to itself)
Multimap<TypeConstructor, TypeProjection> substitution = SubstitutionUtils.buildDeepSubstitutionMultimap(
Multimap<TypeParameterDescriptor, TypeProjection> substitution = SubstitutionUtils.buildDeepSubstitutionMultimap(
TypeUtils.makeUnsubstitutedType(klass, ErrorUtils.createErrorScope("Do not access this scope", true)));
// for each parameter of klass, hold arguments in corresponding supertypes
@@ -547,7 +547,7 @@ public class SignaturesPropagationData {
// 4. typeFromSuper = Baz<Boolean, CharSequence>, parameter = "#1 of Baz", argument = CharSequence
// if it is mapped to klass' parameter, then store it into map
for (TypeProjection projection : substitution.get(parameter.getTypeConstructor())) {
for (TypeProjection projection : substitution.get(parameter)) {
// 1. projection = A
// 2. projection = List<B>
// 3. projection = Boolean