Use TopLevelDeclarations analysis mode in REPL
#KT-12564 Fixed
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
>>> fun fn(): Int {}
|
||||
error: a 'return' expression required in a function with a block body ('{...}')
|
||||
fun fn(): Int {}
|
||||
^
|
||||
@@ -0,0 +1,6 @@
|
||||
>>> if (false) 42
|
||||
>>> if (true) 42
|
||||
>>> "" + (if (true) 42)
|
||||
error: 'if' must have both main and 'else' branches if used as an expression
|
||||
"" + (if (true) 42)
|
||||
^
|
||||
@@ -0,0 +1,11 @@
|
||||
>>> val a = when(null) { }
|
||||
error: 'when' expression must be exhaustive, add necessary 'else' branch
|
||||
val a = when(null) { }
|
||||
^
|
||||
warning: the expression is unused
|
||||
val a = when(null) { }
|
||||
^
|
||||
>>> "" + when (true) { true -> 42 }
|
||||
error: 'when' expression must be exhaustive, add necessary 'false' branch or 'else' branch instead
|
||||
"" + when (true) { true -> 42 }
|
||||
^
|
||||
@@ -0,0 +1,4 @@
|
||||
>>> for (n in 1..10) foo@ { break@foo }
|
||||
error: the label '@foo' does not denote a loop
|
||||
for (n in 1..10) foo@ { break@foo }
|
||||
^
|
||||
@@ -0,0 +1,11 @@
|
||||
>>> val x = 1
|
||||
>>> x = 2
|
||||
error: val cannot be reassigned
|
||||
x = 2
|
||||
^
|
||||
>>> x++
|
||||
error: val cannot be reassigned
|
||||
x++
|
||||
^
|
||||
>>> x
|
||||
1
|
||||
@@ -0,0 +1,12 @@
|
||||
>>> val a: String
|
||||
error: property must be initialized or be abstract
|
||||
val a: String
|
||||
^
|
||||
>>> a
|
||||
error: unresolved reference: a
|
||||
a
|
||||
^
|
||||
>>> val s: String = s
|
||||
error: variable 's' must be initialized
|
||||
val s: String = s
|
||||
^
|
||||
Reference in New Issue
Block a user