Skip to content

Commit 6b80d77

Browse files
committed
Fix #9812: Do not widen types during quote reification
1 parent a05fc4b commit 6b80d77

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class ReifyQuotes extends MacroTransform {
168168
else
169169
val tpe =
170170
if originalTp =:= defn.NilModule.termRef then originalTp // Workaround #4987
171-
else originalTp.widen.dealias
171+
else originalTp.dealias
172172
ref(defn.Unpickler_unpickleExpr).appliedToType(tpe)
173173
val pickledQuoteStrings = liftList(PickledQuotes.pickleQuote(body).map(x => Literal(Constant(x))), defn.StringType)
174174
val splicesList = liftList(splices, defn.FunctionType(1).appliedTo(defn.SeqType.appliedTo(defn.AnyType), defn.AnyType))

tests/pos-macros/i9812.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// compile with -Ycheck:reifyQuotes -Ystop-after:reifyQuotes
2+
import quoted._
3+
4+
sealed abstract class SomeEnum
5+
object SomeEnum:
6+
final val Foo = new SomeEnum {}
7+
8+
def quoteFoo: QuoteContext ?=> Expr[SomeEnum.Foo.type] = '{SomeEnum.Foo}

0 commit comments

Comments
 (0)