Skip to content

Fix #7809: Don't try to create a non-runtime class at ExplicitOuter #7837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ class ExplicitOuter extends MiniPhase with InfoTransformer { thisPhase =>
}

val parents1 =
for (parent <- impl.parents) yield {
for (parent <- impl.parents) yield
val parentCls = parent.tpe.classSymbol.asClass
if (parentCls.is(Trait))
parent
else parent match { // ensure class parent is a constructor
case parent: TypeTree => New(parent.tpe, Nil).withSpan(impl.span)
parent match // ensure class parent is a constructor
case parent: TypeTree
if !parentCls.is(Trait) && !defn.NotRuntimeClasses.contains(parentCls) =>
New(parent.tpe, Nil).withSpan(impl.span)
case _ => parent
}
}
cpy.Template(impl)(parents = parents1, body = impl.body ++ newDefs)
}
else impl
Expand Down
5 changes: 5 additions & 0 deletions tests/pos/i7809.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class A {
trait B extends Any {
println()
}
}