Skip to content

Commit f5d900e

Browse files
committed
Exclude type bound when typing type patterns
1 parent 1a1e8f6 commit f5d900e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,10 @@ class Typer extends Namer
20212021
*/
20222022
private def typedQuotePattern(quoted: untpd.Tree, pt: Type, quoteSpan: Span)(implicit ctx: Context): Tree = {
20232023
val exprPt = pt.baseType(defn.QuotedExprClass)
2024-
val quotedPt = if (exprPt.exists) exprPt.argTypesHi.head else defn.AnyType
2024+
val quotedPt = exprPt.argInfos.headOption match {
2025+
case Some(argPt: ValueType) => argPt // excludes TypeBounds
2026+
case _ => defn.AnyType
2027+
}
20252028
val quoted0 = desugar.quotedPattern(quoted, untpd.TypedSplice(TypeTree(quotedPt)))
20262029
val quoted1 = typedExpr(quoted0, WildcardType)(quoteContext.addMode(Mode.QuotedPattern))
20272030

0 commit comments

Comments
 (0)