[FIR] Implement INT_LITERAL_OUT_OF_RANGE diagnostics, fix tests

This commit is contained in:
Ivan Kochurkin
2021-04-07 15:53:23 +03:00
committed by TeamCityServer
parent fb06da2d75
commit 4cf30cd1fa
20 changed files with 68 additions and 48 deletions
@@ -6,12 +6,12 @@ fun foo(i: Int) = i
fun bar(l: Long) = l
fun main() {
val i = <!ILLEGAL_CONST_EXPRESSION!>111111111111111777777777777777<!>
val i = <!INT_LITERAL_OUT_OF_RANGE!>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 = <!ILLEGAL_CONST_EXPRESSION!>1111111111111117777777777777777<!>
foo(<!ILLEGAL_CONST_EXPRESSION!>11111111111111177777777777777<!>)
bar(<!ILLEGAL_CONST_EXPRESSION!>11111111111111177777777777777<!>)
val l: Long = <!INT_LITERAL_OUT_OF_RANGE!>1111111111111117777777777777777<!>
foo(<!INT_LITERAL_OUT_OF_RANGE!>11111111111111177777777777777<!>)
bar(<!INT_LITERAL_OUT_OF_RANGE!>11111111111111177777777777777<!>)
}
@@ -27,7 +27,7 @@ fun test() {
takeUInt(<!ARGUMENT_TYPE_MISMATCH!>1<!>)
takeULong(<!ARGUMENT_TYPE_MISMATCH!>1<!>)
takeULong(<!ILLEGAL_CONST_EXPRESSION!>18446744073709551615<!>)
takeULong(<!INT_LITERAL_OUT_OF_RANGE!>18446744073709551615<!>)
takeULong(<!ARGUMENT_TYPE_MISMATCH!>1844674407370955161<!>)
takeULong(18446744073709551615u)
@@ -22,4 +22,4 @@ fun test() {
}
val s1: UByte = 256u
val s2 = <!ILLEGAL_CONST_EXPRESSION!>18446744073709551616u<!>
val s2 = <!INT_LITERAL_OUT_OF_RANGE!>18446744073709551616u<!>