From f5aed51fd0f57bcfe6fac09694bf33d9274ff9c2 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Mon, 6 Oct 2014 19:42:23 +0400 Subject: [PATCH] TypeUtils.containsSpecialType() fixed to account for flexible types --- .../diagnostics/tests/platformTypes/samConstructor.txt | 3 +++ .../src/org/jetbrains/jet/lang/types/TypeUtils.java | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/platformTypes/samConstructor.txt diff --git a/compiler/testData/diagnostics/tests/platformTypes/samConstructor.txt b/compiler/testData/diagnostics/tests/platformTypes/samConstructor.txt new file mode 100644 index 00000000000..a60e97c2409 --- /dev/null +++ b/compiler/testData/diagnostics/tests/platformTypes/samConstructor.txt @@ -0,0 +1,3 @@ +package + +internal fun test(): kotlin.Unit \ No newline at end of file diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/TypeUtils.java b/core/descriptors/src/org/jetbrains/jet/lang/types/TypeUtils.java index b97e9501aef..96bfefcc23e 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/TypeUtils.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/TypeUtils.java @@ -533,6 +533,11 @@ public class TypeUtils { ) { if (type == null) return false; if (isSpecialType.invoke(type)) return true; + Flexibility flexibility = type.getCapability(Flexibility.class); + if (flexibility != null + && (containsSpecialType(flexibility.getLowerBound(), isSpecialType) || containsSpecialType(flexibility.getUpperBound(), isSpecialType))) { + return true; + } for (TypeProjection projection : type.getArguments()) { if (containsSpecialType(projection.getType(), isSpecialType)) return true; }