From 5ceb68f19f6712f3a40c0bc8befc2dadf94a98eb Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Fri, 7 Feb 2020 12:51:44 +0300 Subject: [PATCH] [FIR-TEST] Update some testdata --- .../kotlin/fir/types/ConeTypeContext.kt | 3 +- .../operators/plusAndPlusAssign.kt | 2 +- .../tests/CharacterLiterals.fir.kt | 12 +++---- .../tests/IncorrectCharacterLiterals.fir.kt | 34 +++++++++---------- .../tests/StringPrefixAndSuffix.fir.kt | 8 ++--- .../defaultValuesInAnnotation.fir.kt | 2 +- ...ForbidStatementAsDirectFunctionBody.fir.kt | 2 +- ...0.fir.kt351.fir.kt735_StatementType.fir.kt | 10 +++--- .../namedFunAsLastExpressionInBlock.fir.kt | 8 ++--- .../NameDeprecation.fir.kt | 2 +- .../tests/numbers/intValuesOutOfRange.fir.kt | 8 ++--- .../remAndRemAssignAmbiguity.fir.kt | 2 +- .../AssignOperatorAmbiguity.fir.kt | 2 +- .../plusAssignOnLocal.fir.kt | 2 +- .../plusAssignOnProperty.fir.kt | 2 +- .../tests/regressions/kt629.fir.kt | 4 +-- 16 files changed, 52 insertions(+), 51 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt index ff3bcb65072..5de929d2aa9 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/types/ConeTypeContext.kt @@ -486,7 +486,8 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty getClassFqNameUnsafe()?.startsWith(Name.identifier("kotlin")) == true override fun TypeConstructorMarker.getClassFqNameUnsafe(): FqNameUnsafe? { - return toFirRegularClass()?.symbol?.toLookupTag()?.classId?.asSingleFqName()?.toUnsafe() + if (this !is FirClassLikeSymbol<*>) return null + return toLookupTag().classId.asSingleFqName().toUnsafe() } override fun TypeParameterMarker.getName() = (this as FirTypeParameterSymbol).name diff --git a/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt index c89e1843cd2..37eb44f4e01 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt +++ b/compiler/fir/resolve/testData/resolve/expresssions/operators/plusAndPlusAssign.kt @@ -5,5 +5,5 @@ class Foo { fun test() { var f = Foo() - f += f + f += f } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/CharacterLiterals.fir.kt b/compiler/testData/diagnostics/tests/CharacterLiterals.fir.kt index fc9280d4f3a..719495e6aec 100644 --- a/compiler/testData/diagnostics/tests/CharacterLiterals.fir.kt +++ b/compiler/testData/diagnostics/tests/CharacterLiterals.fir.kt @@ -1,13 +1,13 @@ fun test(c : Char) { - test('') + test('') test('a') - test('aa') - test('a) - test(' - test(0' + test('aa') + test('a) + test(' + test(0' test('\n') test('\\') - test('''') + test('''') test('\'') test('\"') } diff --git a/compiler/testData/diagnostics/tests/IncorrectCharacterLiterals.fir.kt b/compiler/testData/diagnostics/tests/IncorrectCharacterLiterals.fir.kt index ae99eb93871..c20e2ea7b61 100644 --- a/compiler/testData/diagnostics/tests/IncorrectCharacterLiterals.fir.kt +++ b/compiler/testData/diagnostics/tests/IncorrectCharacterLiterals.fir.kt @@ -2,11 +2,11 @@ // KT-451 Incorrect character literals cause assertion failures fun ff() { - val b = '' - val c = '23' - val d = 'a - val e = 'ab - val f = '\' + val b = '' + val c = '23' + val d = 'a + val e = 'ab + val f = '\' } fun test() { @@ -19,19 +19,19 @@ fun test() { '\'' '\\' '\$' - '\x' - '\123' - '\ra' - '\000' - '\000' + '\x' + '\123' + '\ra' + '\000' + '\000' '\u0000' '\u000a' '\u000A' - '\u' - '\u0' - '\u00' - '\u000' - '\u000z' - '\\u000' - '\' + '\u' + '\u0' + '\u00' + '\u000' + '\u000z' + '\\u000' + '\' } diff --git a/compiler/testData/diagnostics/tests/StringPrefixAndSuffix.fir.kt b/compiler/testData/diagnostics/tests/StringPrefixAndSuffix.fir.kt index f32edd2fe40..ba80db27c84 100644 --- a/compiler/testData/diagnostics/tests/StringPrefixAndSuffix.fir.kt +++ b/compiler/testData/diagnostics/tests/StringPrefixAndSuffix.fir.kt @@ -11,7 +11,7 @@ fun test(a: Any) { a foo"asd${a}sfsa" a foo"""sdf""" a foo'd' - a foo'' + a foo'' a foo""foo a a foo"asd"foo a @@ -19,17 +19,17 @@ fun test(a: Any) { a foo"asd${a}sfsa"foo a a foo"""sdf"""foo a a foo'd'foo a - a foo''foo a + a foo''foo a a in"foo" a in"""foo""" a in's' - a in'' + a in'' a !in"foo" a !in"""foo""" a !in's' - a !in'' + a !in'' if("s"is Any) {} if("s"is Any) {} diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.fir.kt b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.fir.kt index d193faf0ba5..bee871f04f1 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.fir.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/defaultValuesInAnnotation.fir.kt @@ -9,7 +9,7 @@ annotation class Foo( annotation class Bar( val a: Array = [' '], - val b: Array = ["", ''], + val b: Array = ["", ''], val c: Array = [1] ) diff --git a/compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.fir.kt index 764126042c6..5bc951d9c65 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.fir.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.fir.kt @@ -1,5 +1,5 @@ -fun foo1() = while (b()) {} +fun foo1() = while (b()) {} fun foo2() = for (i in 10) {} diff --git a/compiler/testData/diagnostics/tests/controlStructures/kt770.fir.kt351.fir.kt735_StatementType.fir.kt b/compiler/testData/diagnostics/tests/controlStructures/kt770.fir.kt351.fir.kt735_StatementType.fir.kt index 7fe506f722b..a13c423c946 100644 --- a/compiler/testData/diagnostics/tests/controlStructures/kt770.fir.kt351.fir.kt735_StatementType.fir.kt +++ b/compiler/testData/diagnostics/tests/controlStructures/kt770.fir.kt351.fir.kt735_StatementType.fir.kt @@ -15,7 +15,7 @@ fun main() { } //KT-351 Distinguish statement and expression positions -val w = while (true) {} +val w = while (true) {} fun foo() { var z = 2 @@ -152,12 +152,12 @@ fun bar(a: Unit) {} fun testStatementInExpressionContext() { var z = 34 - val a1: Unit = z = 334 + val a1: Unit = z = 334 val f = for (i in 1..10) {} - if (true) return z = 34 - return while (true) {} + if (true) return z = 34 + return while (true) {} } fun testStatementInExpressionContext2() { - val a2: Unit = while(true) {} + val a2: Unit = while(true) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt index 0546c14f2fb..e42796507fe 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/namedFunAsLastExpressionInBlock.fir.kt @@ -4,7 +4,7 @@ fun foo(block: () -> (() -> Int)) {} fun test() { - val x = fun named1(x: Int): Int { return 1 } + val x = fun named1(x: Int): Int { return 1 } x checkType { _>() } foo { fun named2(): Int {return 1} } @@ -45,12 +45,12 @@ fun test() { x4 checkType { _>() } { y: Int -> fun named14(): Int {return 1} } - val b = (fun named15(): Boolean { return true })() + val b = (fun named15(): Boolean { return true })() - baz(fun named16(){}) + baz(fun named16(){}) } -fun bar() = fun named() {} +fun bar() = fun named() {} fun run(block: () -> T): T = null!! fun run2(block: () -> Unit): Unit = null!! diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/NameDeprecation.fir.kt b/compiler/testData/diagnostics/tests/functionAsExpression/NameDeprecation.fir.kt index 903f86c4815..aabfd382177 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/NameDeprecation.fir.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/NameDeprecation.fir.kt @@ -5,5 +5,5 @@ fun foo() { fun A.foo() {} (fun A.foo() {}) - run(fun foo() {}) + run(fun foo() {}) } diff --git a/compiler/testData/diagnostics/tests/numbers/intValuesOutOfRange.fir.kt b/compiler/testData/diagnostics/tests/numbers/intValuesOutOfRange.fir.kt index 48e649a2cb5..6ab4f630bac 100644 --- a/compiler/testData/diagnostics/tests/numbers/intValuesOutOfRange.fir.kt +++ b/compiler/testData/diagnostics/tests/numbers/intValuesOutOfRange.fir.kt @@ -6,12 +6,12 @@ fun foo(i: Int) = i fun bar(l: Long) = l fun main() { - val i = 111111111111111777777777777777 + val i = 111111111111111777777777777777 //todo add diagnostic text messages //report only 'The value is out of range' //not 'An integer literal does not conform to the expected type Int/Long' - val l: Long = 1111111111111117777777777777777 - foo(11111111111111177777777777777) - bar(11111111111111177777777777777) + val l: Long = 1111111111111117777777777777777 + foo(11111111111111177777777777777) + bar(11111111111111177777777777777) } diff --git a/compiler/testData/diagnostics/tests/operatorRem/remAndRemAssignAmbiguity.fir.kt b/compiler/testData/diagnostics/tests/operatorRem/remAndRemAssignAmbiguity.fir.kt index 4f0bc9ff038..b586bde97c7 100644 --- a/compiler/testData/diagnostics/tests/operatorRem/remAndRemAssignAmbiguity.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorRem/remAndRemAssignAmbiguity.fir.kt @@ -8,5 +8,5 @@ operator fun RemAndRemAssign.remAssign(x: Int) {} fun test() { var c = RemAndRemAssign - c %= 1 + c %= 1 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguity.fir.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguity.fir.kt index 2fcd95faf7b..0d62f497bee 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguity.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/AssignOperatorAmbiguity.fir.kt @@ -11,7 +11,7 @@ fun test(m: MyInt) { m += m var i = 1 - i += 34 + i += 34 } diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnLocal.fir.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnLocal.fir.kt index 4063b709120..eb54f01d26b 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnLocal.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnLocal.fir.kt @@ -9,5 +9,5 @@ fun test() { val c = C() c += "" var c1 = C() - c1 += "" + c1 += "" } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnProperty.fir.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnProperty.fir.kt index fc1bb6297da..c74f3a68210 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnProperty.fir.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/plusAssignOnProperty.fir.kt @@ -15,5 +15,5 @@ fun test() { val c = C() c.c += "" var c1 = C1() - c1.c += "" + c1.c += "" } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt629.fir.kt b/compiler/testData/diagnostics/tests/regressions/kt629.fir.kt index b4cc8300702..341b70069f8 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt629.fir.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt629.fir.kt @@ -13,11 +13,11 @@ fun box() : Boolean { var c = A() val d = c; c %= A(); - return (c != d) && (c.p = "yeah") + return (c != d) && (c.p = "yeah") } fun box2() : Boolean { var c = A() - return (c.p = "yeah") && true + return (c.p = "yeah") && true }