e6b5cb5216
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
47 lines
1.2 KiB
Kotlin
Vendored
47 lines
1.2 KiB
Kotlin
Vendored
class IncDec() {
|
|
operator fun inc() : IncDec = this
|
|
operator fun dec() : IncDec = this
|
|
}
|
|
|
|
fun testIncDec() {
|
|
var x = IncDec()
|
|
x++
|
|
++x
|
|
x--
|
|
--x
|
|
x = <!UNUSED_CHANGED_VALUE!>x++<!>
|
|
x = <!UNUSED_CHANGED_VALUE!>x--<!>
|
|
x = ++x
|
|
<!UNUSED_VALUE!>x =<!> --x
|
|
}
|
|
|
|
class WrongIncDec() {
|
|
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun inc() : Int = 1
|
|
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun dec() : Int = 1
|
|
}
|
|
|
|
fun testWrongIncDec() {
|
|
var x = WrongIncDec()
|
|
x<!RESULT_TYPE_MISMATCH!>++<!>
|
|
<!RESULT_TYPE_MISMATCH!>++<!>x
|
|
x<!RESULT_TYPE_MISMATCH!>--<!>
|
|
<!RESULT_TYPE_MISMATCH!>--<!>x
|
|
}
|
|
|
|
class UnitIncDec() {
|
|
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun inc() : Unit {}
|
|
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun dec() : Unit {}
|
|
}
|
|
|
|
fun testUnitIncDec() {
|
|
var x = UnitIncDec()
|
|
x<!INC_DEC_SHOULD_NOT_RETURN_UNIT!>++<!>
|
|
<!INC_DEC_SHOULD_NOT_RETURN_UNIT!>++<!>x
|
|
x<!INC_DEC_SHOULD_NOT_RETURN_UNIT!>--<!>
|
|
<!INC_DEC_SHOULD_NOT_RETURN_UNIT!>--<!>x
|
|
x = <!UNUSED_CHANGED_VALUE!>x<!INC_DEC_SHOULD_NOT_RETURN_UNIT!>++<!><!>
|
|
x = <!UNUSED_CHANGED_VALUE!>x<!INC_DEC_SHOULD_NOT_RETURN_UNIT!>--<!><!>
|
|
x = <!INC_DEC_SHOULD_NOT_RETURN_UNIT!>++<!>x
|
|
<!UNUSED_VALUE!>x =<!> <!INC_DEC_SHOULD_NOT_RETURN_UNIT!>--<!>x
|
|
}
|