Minor. Fixed references to KotlinBuiltIns.UNIT_ALIAS.

This commit is contained in:
Evgeny Gerashchenko
2012-10-22 15:58:38 +04:00
parent 1817b3daa7
commit 0c43e77ac0
5 changed files with 6 additions and 6 deletions
@@ -336,7 +336,7 @@ public class JetPsiUtil {
return false; return false;
} }
return KotlinBuiltIns.getInstance().UNIT_ALIAS.getName().equals(typeReference.getText()); return KotlinBuiltIns.UNIT_ALIAS.getName().equals(typeReference.getText());
} }
public static boolean isSafeCall(@NotNull Call call) { public static boolean isSafeCall(@NotNull Call call) {
@@ -847,7 +847,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
JetType result; JetType result;
if (operationType == JetTokens.PLUSPLUS || operationType == JetTokens.MINUSMINUS) { if (operationType == JetTokens.PLUSPLUS || operationType == JetTokens.MINUSMINUS) {
if (JetTypeChecker.INSTANCE.isSubtypeOf(returnType, KotlinBuiltIns.getInstance().getUnitType())) { if (JetTypeChecker.INSTANCE.isSubtypeOf(returnType, KotlinBuiltIns.getInstance().getUnitType())) {
result = ErrorUtils.createErrorType(KotlinBuiltIns.getInstance().UNIT_ALIAS.getName()); result = ErrorUtils.createErrorType(KotlinBuiltIns.UNIT_ALIAS.getName());
context.trace.report(INC_DEC_SHOULD_NOT_RETURN_UNIT.on(operationSign)); context.trace.report(INC_DEC_SHOULD_NOT_RETURN_UNIT.on(operationSign));
} }
else { else {
@@ -114,7 +114,7 @@ public class DescriptorRenderer implements Renderer<DeclarationDescriptor> {
return escape(type.toString()); return escape(type.toString());
} }
else if (KotlinBuiltIns.getInstance().isUnit(type)) { else if (KotlinBuiltIns.getInstance().isUnit(type)) {
return escape(KotlinBuiltIns.getInstance().UNIT_ALIAS + (type.isNullable() ? "?" : "")); return escape(KotlinBuiltIns.UNIT_ALIAS + (type.isNullable() ? "?" : ""));
} }
else if (KotlinBuiltIns.getInstance().isTupleType(type)) { else if (KotlinBuiltIns.getInstance().isTupleType(type)) {
return escape(renderTupleType(type, shortNamesOnly)); return escape(renderTupleType(type, shortNamesOnly));
@@ -105,7 +105,7 @@ public class StandardLibraryReferenceResolver extends AbstractProjectComponent {
scope = new WritableScopeImpl(scope, jetNamespace, RedeclarationHandler.THROW_EXCEPTION, scope = new WritableScopeImpl(scope, jetNamespace, RedeclarationHandler.THROW_EXCEPTION,
"Builtin classes scope: needed to analyze builtins which depend on Unit type alias"); "Builtin classes scope: needed to analyze builtins which depend on Unit type alias");
scope.changeLockLevel(WritableScope.LockLevel.BOTH); scope.changeLockLevel(WritableScope.LockLevel.BOTH);
scope.addClassifierAlias(KotlinBuiltIns.getInstance().UNIT_ALIAS, tuple0); scope.addClassifierAlias(KotlinBuiltIns.UNIT_ALIAS, tuple0);
jetNamespace.setMemberScope(scope); jetNamespace.setMemberScope(scope);
TopDownAnalyzer.processStandardLibraryNamespace(myProject, context, scope, jetNamespace, TopDownAnalyzer.processStandardLibraryNamespace(myProject, context, scope, jetNamespace,
@@ -164,7 +164,7 @@ public class StandardLibraryReferenceResolver extends AbstractProjectComponent {
} }
for (DeclarationDescriptor member : descriptors) { for (DeclarationDescriptor member : descriptors) {
if (renderedOriginal.equals(DescriptorRenderer.TEXT.render(member).replace(TUPLE0_FQ_NAME.getFqName(), if (renderedOriginal.equals(DescriptorRenderer.TEXT.render(member).replace(TUPLE0_FQ_NAME.getFqName(),
KotlinBuiltIns.getInstance().UNIT_ALIAS.getName()))) { KotlinBuiltIns.UNIT_ALIAS.getName()))) {
return member; return member;
} }
} }
@@ -62,7 +62,7 @@ public class TypeVisitor extends PsiTypeVisitor<Type> implements J2KVisitor {
final IdentifierImpl identifier = new IdentifierImpl(name); final IdentifierImpl identifier = new IdentifierImpl(name);
if (name.equals("void")) { if (name.equals("void")) {
myResult = new PrimitiveType(new IdentifierImpl(KotlinBuiltIns.getInstance().UNIT_ALIAS.getName())); myResult = new PrimitiveType(new IdentifierImpl(KotlinBuiltIns.UNIT_ALIAS.getName()));
} }
else if (Node.PRIMITIVE_TYPES.contains(name)) { else if (Node.PRIMITIVE_TYPES.contains(name)) {
myResult = new PrimitiveType(new IdentifierImpl(AstUtil.upperFirstCharacter(name))); myResult = new PrimitiveType(new IdentifierImpl(AstUtil.upperFirstCharacter(name)));