Skip to content

Commit 62ea27e

Browse files
committed
Turn off captureSetofInfo caching
1 parent f17b408 commit 62ea27e

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,11 @@ object Capabilities:
495495
def isProvisional = this.core match
496496
case core: TypeProxy => !core.underlying.exists || core.underlying.isProvisional
497497
case _ => false
498-
if !isCaptureChecking || ctx.mode.is(Mode.IgnoreCaptures) || isProvisional then
498+
if !ccConfig.cacheCaptureSetOfInfo
499+
|| !isCaptureChecking
500+
|| ctx.mode.is(Mode.IgnoreCaptures)
501+
|| isProvisional
502+
then
499503
myCaptureSet = null
500504
else
501505
myCaptureSet = computed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import config.{Feature, SourceVersion}
77

88
object ccConfig:
99

10+
/** If enabled, cache capture sets of infos capabilties */
11+
inline val cacheCaptureSetOfInfo = false
12+
1013
/** If enabled, use a special path in recheckClosure for closures
1114
* to compare the result tpt of the anonymous functon with the expected
1215
* result type. This can narrow the scope of error messages.
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/reaches2.scala:10:10 -------------------------------------
1+
-- [E007] Type Mismatch Error: tests/neg-custom-args/captures/reaches2.scala:10:8 --------------------------------------
22
10 | ps.map((x, y) => compose1(x, y)) // error
3-
| ^^^^^^^^^^^^^^^^^^^^^^^
4-
| Found: (x$1: (A^? ->{ps*} A^?, A^? ->{ps*} A^?)^?) ->{ps*} A^? ->{ps*} A^?
5-
| Required: ((A ->{ps*} A, A ->{ps*} A)) -> A^? ->? A^?
6-
| Note that capability ps* is not included in capture set {}.
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
| Found: List[A^? ->{ps*, cap, cap²} A^?]
5+
| Required: List[A ->{ps*} A]
6+
|
7+
| where: cap is a fresh root capability created in method mapCompose when computing deep capture set of A
8+
| cap² is a fresh root capability created in method mapCompose when computing deep capture set of A
9+
|
10+
| Note that capability cap is not included in capture set {ps*}.
711
|
812
| longer explanation available when compiling with `-explain`

0 commit comments

Comments
 (0)