From 7eaac0bf2ae89be5b4418f6ff9b8fa810b492d68 Mon Sep 17 00:00:00 2001 From: Juan Chen Date: Fri, 3 Jan 2020 10:28:02 -0800 Subject: [PATCH] [FIR]: allow char comparison in Fir2Ir --- .../fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt | 1 + compiler/testData/codegen/box/binaryOp/compareBoxedChars.kt | 1 - compiler/testData/codegen/box/primitiveTypes/kt4251.kt | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 2a1595e6096..ce95099e50a 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -1245,6 +1245,7 @@ class Fir2IrVisitor( ClassId(FqName("kotlin"), FqName("Int"), false) -> irBuiltIns.intType ClassId(FqName("kotlin"), FqName("Float"), false) -> irBuiltIns.floatType ClassId(FqName("kotlin"), FqName("Double"), false) -> irBuiltIns.doubleType + ClassId(FqName("kotlin"), FqName("Char"), false) -> irBuiltIns.charType else -> { return IrErrorCallExpressionImpl( startOffset, endOffset, booleanType, "Comparison of arguments with unsupported type: $classId" diff --git a/compiler/testData/codegen/box/binaryOp/compareBoxedChars.kt b/compiler/testData/codegen/box/binaryOp/compareBoxedChars.kt index 050910c5529..f472ebfc47d 100644 --- a/compiler/testData/codegen/box/binaryOp/compareBoxedChars.kt +++ b/compiler/testData/codegen/box/binaryOp/compareBoxedChars.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun id(x: T) = x fun box(): String { diff --git a/compiler/testData/codegen/box/primitiveTypes/kt4251.kt b/compiler/testData/codegen/box/primitiveTypes/kt4251.kt index 724fa80f397..eda602589c0 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt4251.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt4251.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { val a: Char? = 'a' val result = a!! < 'b'