Skip to content
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
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/ast/TreeTypeMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package ast

import core._
import Types._, Contexts._
import Symbols._, Annotations._, Trees._, Symbols._
import Symbols._, Annotations._, Trees._, Symbols._, Constants.Constant
import Decorators._
import dotty.tools.dotc.transform.SymUtils._
import core.tasty.TreePickler.Hole
Expand Down Expand Up @@ -124,6 +124,8 @@ class TreeTypeMap(
cpy.Labeled(labeled)(bind1, expr1)
case Hole(isTermHole, n, args) =>
Hole(isTermHole, n, args.mapConserve(transform)).withSpan(tree.span).withType(mapType(tree.tpe))
case lit @ Literal(Constant(tpe: Type)) =>
cpy.Literal(lit)(Constant(mapType(tpe)))
case tree1 =>
super.transform(tree1)
}
Expand Down
6 changes: 4 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,10 @@ object Symbols {
info = completer,
privateWithin = ttmap1.mapOwner(odenot.privateWithin), // since this refers to outer symbols, need not include copies (from->to) in ownermap here.
annotations = odenot.annotations)
copy.registeredCompanion =
copy.registeredCompanion.subst(originals, copies)
copy.denot match
case cd: ClassDenotation =>
cd.registeredCompanion = cd.unforcedRegisteredCompanion.subst(originals, copies)
case _ =>
}

copies.foreach(_.ensureCompleted()) // avoid memory leak
Expand Down
38 changes: 38 additions & 0 deletions tests/pos/i10542.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package test_10542:

trait Foo {
inline def foo[A](t: => A): Unit = ()
}

object Bar extends Foo

object Test {
Bar.foo {
sealed trait T1
case object S1 extends T1
}
}

package test_10540:

trait Foo {
inline def foo[A](t: => A): Unit = ()
}

object Bar extends Foo

object Test {
Bar.foo {
trait T1
val array = Array(new T1 {})
}
}

package test_9655:

inline def foo[T](inline body: T): T = body

def test = foo {
sealed trait Status
object Active extends Status
}