Introduce language feature: underscores in numeric literals

#KT-2964 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2016-11-06 20:37:04 +03:00
parent a77290e572
commit 3df5efb236
10 changed files with 126 additions and 4 deletions
@@ -0,0 +1,19 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
fun foo() {
<!ILLEGAL_UNDERSCORE!>1_<!>
<!ILLEGAL_UNDERSCORE!>0x_f<!>
<!ILLEGAL_UNDERSCORE!>0X_f<!>
<!ILLEGAL_UNDERSCORE!>0b_1<!>
<!ILLEGAL_UNDERSCORE!>0B_1<!>
<!ILLEGAL_UNDERSCORE!>1.0_<!>
<!ILLEGAL_UNDERSCORE!>1_.1<!>
<!ILLEGAL_UNDERSCORE!>1._1<!>
<!ILLEGAL_UNDERSCORE!>1_._1<!>
<!ILLEGAL_UNDERSCORE!>1.0_e1<!>
<!ILLEGAL_UNDERSCORE!>1.0E_1<!>
<!ILLEGAL_UNDERSCORE!>0Xe_<!>
<!ILLEGAL_UNDERSCORE!>1.1_e-1_23<!>
<!ILLEGAL_UNDERSCORE!>1.0e+_0<!>
<!ILLEGAL_UNDERSCORE!>1.0e-_0<!>
}
@@ -0,0 +1,3 @@
package
public fun foo(): kotlin.Unit
@@ -0,0 +1,10 @@
// !LANGUAGE: -UnderscoresInNumericLiterals
// !DIAGNOSTICS: -UNUSED_EXPRESSION
fun foo() {
<!UNSUPPORTED_FEATURE!>100_1<!>
<!UNSUPPORTED_FEATURE!>3_.1<!>
<!UNSUPPORTED_FEATURE!>3_._1<!>
<!UNSUPPORTED_FEATURE!>2___4<!>
<!UNSUPPORTED_FEATURE!>123_<!>
}
@@ -0,0 +1,3 @@
package
public fun foo(): kotlin.Unit