Open
Description
Compiler version
3.6.4
Minimized code
Welcome to Scala 3.7.1-RC1-bin-SNAPSHOT-nonbootstrapped-git-eb2c406 (23.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> List(res0).map: i =>
| i+1
|
-- [E045] Cyclic Error: --------------------------------------------------------
1 |List(res0).map: i =>
| ^
| Recursive value res0 needs type
|
| Run with -explain-cyclic for more details.
|
| longer explanation available when compiling with `-explain`
1 error found
That was by accidentally back-arrow into history. Simpler if less realistic:
Welcome to Scala 3.6.4 (23.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> res0
-- [E045] Cyclic Error: --------------------------------------------------------
1 |res0
|^
|Recursive value res0 needs type
|
| Run with -explain-cyclic for more details.
|
| longer explanation available when compiling with `-explain`
1 error found
Output
As shown.
Expectation
REPL could be more hygienic about "result" names. Scala 2 makes some accommodations for pasting code, but also demonstrates this problem.
This would be a more interesting bug if REPL supported re-evaluation by mutating inputs from history, more like a spreadsheet.