From c6fcbf6172bd53aac8e2d25f534032c6c313098f Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Mon, 29 May 2017 09:59:42 +0300 Subject: [PATCH] [NI] Check for unwrapped descriptor when generating accessible function In new inference we get copy of sam constructor and therefore should check original descriptor in BE. This fixes 'protectedSamConstructor' test --- .../org/jetbrains/kotlin/codegen/context/CodegenContext.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java index 67edd23c271..e1389b9278e 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/CodegenContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. + * Copyright 2010-2017 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. @@ -574,7 +574,7 @@ public abstract class CodegenContext { if (descriptorContext == null && JavaVisibilities.PROTECTED_STATIC_VISIBILITY == descriptor.getVisibility() && - !(descriptor instanceof SamConstructorDescriptor)) { + (!(descriptor.getOriginal() instanceof SamConstructorDescriptor))) { //seems we need static receiver in resolved call descriptorContext = ExpressionCodegen.getParentContextSubclassOf((ClassDescriptor) enclosed, this); superCallTarget = (ClassDescriptor) enclosed;