Skip to content

Commit e748d85

Browse files
committed
Only check explicitly given type arguments
1 parent 337dce8 commit e748d85

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,11 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
345345
val tree1 @ TypeApply(fn, args) = normalizeTypeArgs(tree)
346346
for arg <- args do
347347
checkInferredWellFormed(arg)
348-
Checking.checkGoodBounds(arg.tpe, arg.srcPos)
348+
if !arg.span.isSynthetic then
349+
// only check explicit type arguments. We rely on inferred type arguments
350+
// to either have good bounds (if they come from a constraint), or be derived
351+
// from values that recursively need to have good bounds.
352+
Checking.checkGoodBounds(arg.tpe, arg.srcPos)
349353
if (fn.symbol != defn.ChildAnnot.primaryConstructor)
350354
// Make an exception for ChildAnnot, which should really have AnyKind bounds
351355
Checking.checkBounds(args, fn.tpe.widen.asInstanceOf[PolyType])

0 commit comments

Comments
 (0)