Skip to content

Commit 375d1f0

Browse files
committed
Fix #9206: Add missing type symbol in Scala2 constructors
1 parent de75713 commit 375d1f0

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ object Scala2Unpickler {
5757

5858
def addConstructorTypeParams(denot: SymDenotation)(implicit ctx: Context): Unit = {
5959
assert(denot.isConstructor)
60-
denot.info = PolyType.fromParams(denot.owner.typeParams, denot.info)
60+
val typeParams = denot.owner.typeParams
61+
denot.info = PolyType.fromParams(typeParams, denot.info)
62+
if typeParams.nonEmpty then
63+
denot.rawParamss = typeParams :: denot.rawParamss
6164
}
6265

6366
/** Convert array parameters denoting a repeated parameter of a Java method

tests/run-macros/i9206/Macros_1.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
import scala.quoted.{Expr, QuoteContext}
3+
4+
object Inspect {
5+
inline def inspect[T <: AnyKind]: String = ${ inspectTpe[T] }
6+
7+
def inspectTpe[T <: AnyKind](using tpe: quoted.Type[T], qctx0: QuoteContext): Expr[String] = {
8+
val tree = summon[quoted.Type[T]].unseal.tpe.typeSymbol.tree
9+
Expr(tree.show)
10+
}
11+
}

tests/run-macros/i9206/Test_2.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Inspect._
2+
3+
object Test extends App {
4+
inspect[scala.collection.immutable.List[Int]]
5+
inspect[java.lang.String]
6+
inspect[String]
7+
inspect[List[Unit]]
8+
inspect[Some[Unit]]
9+
inspect[Tuple1[Unit]]
10+
}

0 commit comments

Comments
 (0)