Skip to content

Commit cd87360

Browse files
Merge pull request #3804 from dotty-staging/fix-#2495
Fix #2495: Improve error message
2 parents 9a654d7 + a51091b commit cd87360

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,15 @@ object messages {
189189
val msg = {
190190
val ofFun =
191191
if (MethodType.syntheticParamNames(args.length + 1) contains param.name)
192-
i" of expanded function $tree"
192+
i" of expanded function:\n$tree"
193193
else
194194
""
195195

196-
i"""missing parameter type for parameter ${param.name}$ofFun, expected = $pt
197-
|The argument types of an anonymous function must be fully known. (SLS 8.5)"""
196+
i"""missing parameter type
197+
|
198+
|The argument types of an anonymous function must be fully known. (SLS 8.5)
199+
|Expected type: $pt
200+
|Missing type for parameter ${param.name}$ofFun"""
198201
}
199202

200203
val explanation =
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
scala> val xs = scala.collection.mutable.ListBuffer[Int]
22
1 | val xs = scala.collection.mutable.ListBuffer[Int]
33
| ^
4-
|missing parameter type for parameter elems, expected = ?
4+
|missing parameter type
5+
|
56
|The argument types of an anonymous function must be fully known. (SLS 8.5)
7+
|Expected type: ?
8+
|Missing type for parameter elems
69
scala> val xs = scala.collection.mutable.ListBuffer[Int]()
710
val xs: scala.collection.mutable.ListBuffer[Int] = ListBuffer()

0 commit comments

Comments
 (0)