Skip to content

Commit f47efc0

Browse files
authored
Merge pull request #7837 from dotty-staging/fix-#7809
Fix #7809: Don't try to create a non-runtime class at ExplicitOuter
2 parents 64b4eb4 + 8bcd448 commit f47efc0

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,13 @@ class ExplicitOuter extends MiniPhase with InfoTransformer { thisPhase =>
9797
}
9898

9999
val parents1 =
100-
for (parent <- impl.parents) yield {
100+
for (parent <- impl.parents) yield
101101
val parentCls = parent.tpe.classSymbol.asClass
102-
if (parentCls.is(Trait))
103-
parent
104-
else parent match { // ensure class parent is a constructor
105-
case parent: TypeTree => New(parent.tpe, Nil).withSpan(impl.span)
102+
parent match // ensure class parent is a constructor
103+
case parent: TypeTree
104+
if !parentCls.is(Trait) && !defn.NotRuntimeClasses.contains(parentCls) =>
105+
New(parent.tpe, Nil).withSpan(impl.span)
106106
case _ => parent
107-
}
108-
}
109107
cpy.Template(impl)(parents = parents1, body = impl.body ++ newDefs)
110108
}
111109
else impl

tests/pos/i7809.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class A {
2+
trait B extends Any {
3+
println()
4+
}
5+
}

0 commit comments

Comments
 (0)