Skip to content

Commit 8c8d6e4

Browse files
committed
Generalize application rule to all methods
1 parent 2724ac7 commit 8c8d6e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ class CheckCaptures extends Recheck, SymTransformer:
421421
super.recheckApply(tree, pt) match
422422
case tp @ CapturingType(tp1, refs) =>
423423
tree.fun match
424-
case Select(qual, nme.apply)
425-
if defn.isFunctionType(qual.tpe.widen)
424+
case Select(qual, _)
425+
if !tree.fun.symbol.isConstructor
426426
&& qual.tpe.captureSet.mightSubcapture(refs)
427427
&& tree.args.forall(_.tpe.captureSet.mightSubcapture(refs))
428428
=>

0 commit comments

Comments
 (0)