[FIR] Add lValueTypeRef to FirVariableAssignment, fix tests with ASSIGNMENT_TYPE_MISMATCH

This commit is contained in:
Ivan Kochurkin
2021-05-13 17:06:04 +03:00
committed by TeamCityServer
parent e57108d4e8
commit c3b8f3e859
28 changed files with 127 additions and 87 deletions
+12 -12
View File
@@ -22,10 +22,10 @@ class WrongIncDec() {
fun testWrongIncDec() {
var x = WrongIncDec()
<error descr="[RESULT_TYPE_MISMATCH] WrongIncDec, kotlin/Int">x++</error>
<error descr="[RESULT_TYPE_MISMATCH] WrongIncDec, kotlin/Int">++x</error>
<error descr="[RESULT_TYPE_MISMATCH] WrongIncDec, kotlin/Int">x--</error>
<error descr="[RESULT_TYPE_MISMATCH] WrongIncDec, kotlin/Int">--x</error>
<error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Int but WrongIncDec was expected">x++</error>
<error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Int but WrongIncDec was expected">++x</error>
<error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Int but WrongIncDec was expected">x--</error>
<error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Int but WrongIncDec was expected">--x</error>
}
class UnitIncDec() {
@@ -35,12 +35,12 @@ class UnitIncDec() {
fun testUnitIncDec() {
var x = UnitIncDec()
<error descr="[RESULT_TYPE_MISMATCH] UnitIncDec, kotlin/Unit">x++</error>
<error descr="[RESULT_TYPE_MISMATCH] UnitIncDec, kotlin/Unit">++x</error>
<error descr="[RESULT_TYPE_MISMATCH] UnitIncDec, kotlin/Unit">x--</error>
<error descr="[RESULT_TYPE_MISMATCH] UnitIncDec, kotlin/Unit">--x</error>
x = <error descr="[RESULT_TYPE_MISMATCH] UnitIncDec, kotlin/Unit">x++</error>
x = <error descr="[RESULT_TYPE_MISMATCH] UnitIncDec, kotlin/Unit">x--</error>
x = <error descr="[RESULT_TYPE_MISMATCH] UnitIncDec, kotlin/Unit">++x</error>
x = <error descr="[RESULT_TYPE_MISMATCH] UnitIncDec, kotlin/Unit">--x</error>
<error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Unit but UnitIncDec was expected">x++</error>
<error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Unit but UnitIncDec was expected">++x</error>
<error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Unit but UnitIncDec was expected">x--</error>
<error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Unit but UnitIncDec was expected">--x</error>
x = <error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Unit but UnitIncDec was expected">x++</error>
x = <error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Unit but UnitIncDec was expected">x--</error>
x = <error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Unit but UnitIncDec was expected">++x</error>
x = <error descr="[RESULT_TYPE_MISMATCH] Function return type mismatch: actual type is kotlin/Unit but UnitIncDec was expected">--x</error>
}
+1 -1
View File
@@ -2,7 +2,7 @@
get() : Int = 1
set(value : <error descr="[WRONG_SETTER_PARAMETER_TYPE] Setter parameter type must be equal to the type of the property, i.e. 'kotlin/Int'">Long</error>) {
field = value.toInt()
field = 1.toLong()
field = <error descr="[ASSIGNMENT_TYPE_MISMATCH] Assignment type mismatch: actual type is kotlin/Long but kotlin/Int was expected">1.toLong()</error>
}
val xx : Int = <error descr="[PROPERTY_INITIALIZER_NO_BACKING_FIELD] Initializer is not allowed here because this property has no backing field">1 + x</error>
+1 -1
View File
@@ -2,7 +2,7 @@ class A() {
var x: Int = 0
get() = "s"
set(value: <error descr="[WRONG_SETTER_PARAMETER_TYPE] Setter parameter type must be equal to the type of the property, i.e. 'kotlin/Int'">String</error>) {
field = value
field = <error descr="[ASSIGNMENT_TYPE_MISMATCH] Assignment type mismatch: actual type is kotlin/String but kotlin/Int was expected">value</error>
}
val y: Int
get(): <error descr="[WRONG_GETTER_RETURN_TYPE] Getter return type must be equal to the type of the property, i.e. 'kotlin/Int'">String</error> = "s"