-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Compiler version
Scala compiler version 3.0.2
Minimized code
val good1: String => String = _.toLowerCase
val good2 = (s:String) => s.toLowerCase
val (_, good3) = (1, (s: String) => s.toLowerCase)
val (_, good4: String) = (1, "abc")
val (_, bad1: String => String) = (1, _.toLowerCase)
val (_, bad2: (String) => String) = (1, _.toLowerCase)
val (_, bad3: (String => String)) = (1, _.toLowerCase)
val (_, bad4: (String => String)) = (1, s => s.toLowerCase)Output
-- [E040] Syntax Error: test.scala:9:21 --------------------------------------------------------------------------------
9 |val (_, bad1: String => String) = (1, _.toLowerCase)
| ^^
| ')' expected, but '=>' found
-- [E040] Syntax Error: test.scala:11:23 -------------------------------------------------------------------------------
11 |val (_, bad2: (String) => String) = (1, _.toLowerCase)
| ^^
| ')' expected, but '=>' found
-- [E081] Type Error: test.scala:9:38 ----------------------------------------------------------------------------------
9 |val (_, bad1: String => String) = (1, _.toLowerCase)
| ^
| Missing parameter type
|
| I could not infer the type of the parameter _$2 of expanded function:
| _$2 => _$2.toLowerCase.
-- [E081] Type Error: test.scala:11:40 ---------------------------------------------------------------------------------
11 |val (_, bad2: (String) => String) = (1, _.toLowerCase)
| ^
| Missing parameter type
|
| I could not infer the type of the parameter _$3 of expanded function:
| _$3 => _$3.toLowerCase.
-- [E081] Type Error: test.scala:13:40 ---------------------------------------------------------------------------------
13 |val (_, bad3: (String => String)) = (1, _.toLowerCase)
| ^
| Missing parameter type
|
| I could not infer the type of the parameter _$4 of expanded function:
| _$4 => _$4.toLowerCase.
-- [E081] Type Error: test.scala:15:40 ---------------------------------------------------------------------------------
15 |val (_, bad4: (String => String)) = (1, s => s.toLowerCase)
| ^
| Missing parameter type
|
| I could not infer the type of the parameter s.
6 errors found
Expectation
I expected the code to compile properly.
Metadata
Metadata
Assignees
Labels
No labels