From 3f18bb6d4bd97cd1b7ccbfd34db39eda75de3f13 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Wed, 7 Nov 2012 19:59:12 +0400 Subject: [PATCH] Minor. Better parameters/variables naming. --- .../BasicExpressionTypingVisitor.java | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java index bd22c7d6f2b..4622569ba9f 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/expressions/BasicExpressionTypingVisitor.java @@ -279,37 +279,37 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { } /** - * Check if assignment from ActualType to TargetType is erased. + * Check if assignment from supertype to subtype is erased. * It is an error in "is" statement and warning in "as". */ - public static boolean isCastErased(JetType actualType, JetType targetType, JetTypeChecker typeChecker) { - if (!(targetType.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) { + public static boolean isCastErased(JetType supertype, JetType subtype, JetTypeChecker typeChecker) { + if (!(subtype.getConstructor().getDeclarationDescriptor() instanceof ClassDescriptor)) { // TODO: what if it is TypeParameterDescriptor? return false; } // do not crash on error types - if (ErrorUtils.isErrorType(actualType) || ErrorUtils.isErrorType(targetType)) { + if (ErrorUtils.isErrorType(supertype) || ErrorUtils.isErrorType(subtype)) { return false; } - List actualTypeParameters = actualType.getConstructor().getParameters(); + List superTypeParameters = supertype.getConstructor().getParameters(); { - Multimap typeSubstitutionMap = - SubstitutionUtils.buildDeepSubstitutionMultimap(targetType); + Multimap subtypeSubstitutionMap = + SubstitutionUtils.buildDeepSubstitutionMultimap(subtype); - for (int i = 0; i < actualTypeParameters.size(); i++) { - TypeProjection actualTypeArgument = actualType.getArguments().get(i); - TypeParameterDescriptor actualTypeParameter = actualTypeParameters.get(i); + for (int i = 0; i < superTypeParameters.size(); i++) { + TypeProjection superTypeArgument = supertype.getArguments().get(i); + TypeParameterDescriptor superTypeParameter = superTypeParameters.get(i); - if (actualTypeParameter.isReified()) { + if (superTypeParameter.isReified()) { continue; } - Collection substituted = typeSubstitutionMap.get(actualTypeParameter.getTypeConstructor()); + Collection substituted = subtypeSubstitutionMap.get(superTypeParameter.getTypeConstructor()); for (TypeProjection substitutedProjection : substituted) { - //if (!substitutedProjection.getType().equals(actualTypeArgument.getType())) { - if (!typeChecker.isSubtypeOf(actualTypeArgument.getType(), substitutedProjection.getType())) { // TODO hides error + //if (!substitutedProjection.getType().equals(superTypeArgument.getType())) { + if (!typeChecker.isSubtypeOf(superTypeArgument.getType(), substitutedProjection.getType())) { // TODO hides error return true; } } @@ -317,31 +317,31 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor { } { - JetType targetTypeCleared = TypeUtils.makeUnsubstitutedType( - (ClassDescriptor) targetType.getConstructor().getDeclarationDescriptor(), null); + JetType subtypeCleared = TypeUtils.makeUnsubstitutedType( + (ClassDescriptor) subtype.getConstructor().getDeclarationDescriptor(), null); Multimap clearTypeSubstitutionMap = - SubstitutionUtils.buildDeepSubstitutionMultimap(targetTypeCleared); + SubstitutionUtils.buildDeepSubstitutionMultimap(subtypeCleared); Set clearSubstituted = new HashSet(); - for (TypeParameterDescriptor actualTypeParameter : actualTypeParameters) { - Collection substituted = clearTypeSubstitutionMap.get(actualTypeParameter.getTypeConstructor()); + for (TypeParameterDescriptor superTypeParameter : superTypeParameters) { + Collection substituted = clearTypeSubstitutionMap.get(superTypeParameter.getTypeConstructor()); for (TypeProjection substitutedProjection : substituted) { clearSubstituted.add(substitutedProjection.getType()); } } - List targetTypeParameters = targetType.getConstructor().getParameters(); - for (int i = 0; i < targetTypeParameters.size(); i++) { - TypeParameterDescriptor typeParameter = targetTypeParameters.get(i); + List subTypeParameters = subtype.getConstructor().getParameters(); + for (int i = 0; i < subTypeParameters.size(); i++) { + TypeParameterDescriptor typeParameter = subTypeParameters.get(i); if (typeParameter.isReified()) { continue; } // "is List<*>" - TypeProjection typeArgument = targetType.getArguments().get(i); + TypeProjection typeArgument = subtype.getArguments().get(i); if (typeArgument.equals(SubstitutionUtils.makeStarProjection(typeParameter))) { continue; }