Skip to content

Commit 730e50b

Browse files
Merge pull request #2481 from Varunram/implicitclass
Fix crash for top level implicit class declaration
2 parents 64f7320 + dad65ae commit 730e50b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ object messages {
352352
val explanation = {
353353
val TypeDef(name, impl @ Template(constr0, parents, self, _)) = cdef
354354
val exampleArgs =
355-
constr0.vparamss(0).map(_.withMods(untpd.Modifiers()).show).mkString(", ")
355+
if(constr0.vparamss.isEmpty) "..."
356+
else constr0.vparamss(0).map(_.withMods(untpd.Modifiers()).show).mkString(", ")
356357
def defHasBody[T] = impl.body.exists(!_.isEmpty)
357358
val exampleBody = if (defHasBody) "{\n ...\n }" else ""
358359
hl"""|There may not be any method, member or object in scope with the same name as

tests/neg/i2463.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
implicit class Foo // error

0 commit comments

Comments
 (0)