Skip to content

Commit bb50f8b

Browse files
committed
Check that the trees are typed before accessing the symbol
1 parent d705133 commit bb50f8b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
318318
if (name.isTypeName) typeText(txt)
319319
else txt
320320
case tree @ Select(qual, name) =>
321-
if (tree.symbol == defn.QuotedExpr_~ || tree.symbol == defn.QuotedType_~) keywordStr("~(") ~ toTextLocal(qual) ~ keywordStr(")")
321+
if (tree.hasType && tree.symbol == defn.QuotedExpr_~ || tree.symbol == defn.QuotedType_~) keywordStr("~(") ~ toTextLocal(qual) ~ keywordStr(")")
322322
else if (qual.isType) toTextLocal(qual) ~ "#" ~ typeText(toText(name))
323323
else toTextLocal(qual) ~ ("." ~ nameIdText(tree) provided name != nme.CONSTRUCTOR)
324324
case tree: This =>
@@ -330,9 +330,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
330330
changePrec (GlobalPrec) {
331331
keywordStr("throw ") ~ toText(args.head)
332332
}
333-
else if (fun.symbol == defn.QuotedExpr_apply)
333+
else if (fun.hasType && fun.symbol == defn.QuotedExpr_apply)
334334
keywordStr("'{") ~ toTextGlobal(args, ", ") ~ keywordStr("}")
335-
else if (fun.symbol == defn.QuotedType_apply)
335+
else if (fun.hasType && fun.symbol == defn.QuotedType_apply)
336336
keywordStr("'[") ~ toTextGlobal(args, ", ") ~ keywordStr("]")
337337
else
338338
toTextLocal(fun) ~ "(" ~ toTextGlobal(args, ", ") ~ ")"

0 commit comments

Comments
 (0)