From 15c5a58b3ae1401aad29f9eb50d410f533dec730 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 30 Dec 2013 17:48:19 +0400 Subject: [PATCH] Add assert messages --- .../jet/codegen/binding/CodegenAnnotatingVisitor.java | 6 ++++-- .../org/jetbrains/jet/codegen/binding/CodegenBinding.java | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/binding/CodegenAnnotatingVisitor.java b/compiler/backend/src/org/jetbrains/jet/codegen/binding/CodegenAnnotatingVisitor.java index 85aaaf21f17..c61de402204 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/binding/CodegenAnnotatingVisitor.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/binding/CodegenAnnotatingVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 JetBrains s.r.o. + * Copyright 2010-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -171,7 +171,9 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid { @Override public void visitClassObject(@NotNull JetClassObject classObject) { ClassDescriptor classDescriptor = bindingContext.get(CLASS, classObject.getObjectDeclaration()); - assert classDescriptor != null; + + assert classDescriptor != null : String.format("No class found in binding context for: \n---\n%s\n---\n", + JetPsiUtil.getElementTextWithContext(classObject)); String name = peekFromStack(nameStack) + JvmAbi.CLASS_OBJECT_SUFFIX; recordClosure(classObject, classDescriptor, name); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/binding/CodegenBinding.java b/compiler/backend/src/org/jetbrains/jet/codegen/binding/CodegenBinding.java index 60ef4d09c8d..2bfcfe11545 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/binding/CodegenBinding.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/binding/CodegenBinding.java @@ -337,8 +337,12 @@ public class CodegenBinding { } for (JetDelegationSpecifier specifier : ((JetClassOrObject) classOrObject).getDelegationSpecifiers()) { if (specifier instanceof JetDelegatorToSuperCall) { - JetType superType = bindingContext.get(TYPE, specifier.getTypeReference()); - assert superType != null; + JetTypeReference typeReference = specifier.getTypeReference(); + + JetType superType = bindingContext.get(TYPE, typeReference); + assert superType != null: String.format( + "No type in binding context for \n---\n%s\n---\n", JetPsiUtil.getElementTextWithContext(specifier)); + ClassDescriptor superClassDescriptor = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor(); assert superClassDescriptor != null; if (!isInterface(superClassDescriptor)) {