Skip to content

Commit 856b584

Browse files
committed
Hack: use monotonicity trick only for empty-parameter-list functions
like () ?=> T, () => T
1 parent 1530829 commit 856b584

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ class CheckCaptures extends Recheck, SymTransformer:
789789
case appType @ CapturingType(appType1, refs)
790790
if qualType.exists
791791
&& !tree.fun.symbol.isConstructor
792+
&& funType.paramInfos.isEmpty
792793
&& qualCaptures.mightSubcapture(refs)
793794
&& argCaptures.forall(_.mightSubcapture(refs)) =>
794795
val callCaptures = argCaptures.foldLeft(qualCaptures)(_ ++ _)

0 commit comments

Comments
 (0)