From 8ed45270a414a7a9b2b7b6b037e587e1b33f5fba Mon Sep 17 00:00:00 2001 From: odersky Date: Tue, 12 Aug 2025 14:13:31 +0200 Subject: [PATCH 1/2] Simplify ParamRef disambiguation --- .../dotty/tools/dotc/reporting/Message.scala | 28 ++++--------------- tests/neg-custom-args/captures/filevar.check | 2 +- tests/neg-custom-args/captures/i15923.check | 8 ++---- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/reporting/Message.scala b/compiler/src/dotty/tools/dotc/reporting/Message.scala index de0d9fdd7131..9fd89ca91066 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Message.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Message.scala @@ -62,13 +62,6 @@ object Message: */ private class Seen(disambiguate: Disambiguation): - /** The set of lambdas that were opened at some point during printing. */ - private val openedLambdas = new collection.mutable.HashSet[LambdaType] - - /** Register that `tp` was opened during printing. */ - def openLambda(tp: LambdaType): Unit = - openedLambdas += tp - val seen = new collection.mutable.HashMap[SeenKey, List[Recorded]].withDefaultValue(Nil) var nonSensical = false @@ -109,16 +102,17 @@ object Message: lazy val dealiased = followAlias(entry) /** All lambda parameters with the same name are given the same superscript as - * long as their corresponding binder has been printed. - * See tests/neg/lambda-rename.scala for test cases. + * long as their corresponding binders have the same parameter name lists. + * This avoids spurious distinctions between parameters of mapped lambdas at + * the risk that sometimes we cannot distinguish parameters of distinct functions + * that have the same parameter names. See tests/neg/lambda-rename.scala for test cases. */ def sameSuperscript(cur: Recorded, existing: Recorded) = (cur eq existing) || (cur, existing).match case (cur: ParamRef, existing: ParamRef) => - (cur.paramName eq existing.paramName) && - openedLambdas.contains(cur.binder) && - openedLambdas.contains(existing.binder) + (cur.paramName eq existing.paramName) + && cur.binder.paramNames == existing.binder.paramNames case _ => false @@ -266,20 +260,10 @@ object Message: case _ => super.funMiddleText(isContextual, isPure, refs) - override def toTextMethodAsFunction(info: Type, isPure: Boolean, refs: GeneralCaptureSet | Null): Text = - info match - case info: LambdaType => - seen.openLambda(info) - case _ => - super.toTextMethodAsFunction(info, isPure, refs) - override def toText(tp: Type): Text = if !tp.exists || tp.isErroneous then seen.nonSensical = true tp match case tp: TypeRef if useSourceModule(tp.symbol) => Str("object ") ~ super.toText(tp) - case tp: LambdaType => - seen.openLambda(tp) - super.toText(tp) case _ => super.toText(tp) override def toText(sym: Symbol): Text = diff --git a/tests/neg-custom-args/captures/filevar.check b/tests/neg-custom-args/captures/filevar.check index 81a41fe3c257..565b78b9aa0b 100644 --- a/tests/neg-custom-args/captures/filevar.check +++ b/tests/neg-custom-args/captures/filevar.check @@ -4,7 +4,7 @@ |Found: (f: File^'s1) ->'s2 Unit |Required: (f: File^{l}) => Unit | - |where: => refers to a fresh root capability created in anonymous function of type (using l²: scala.caps.Capability): File^{l²} -> Unit when instantiating expected result type (f: File^{l}) ->{cap} Unit of function literal + |where: => refers to a fresh root capability created in anonymous function of type (using l: scala.caps.Capability): File^{l} -> Unit when instantiating expected result type (f: File^{l}) ->{cap} Unit of function literal | |Note that capability l cannot be included in outer capture set 's1 of parameter f. 16 | val o = Service() diff --git a/tests/neg-custom-args/captures/i15923.check b/tests/neg-custom-args/captures/i15923.check index 1adeeb60edb8..900098266707 100644 --- a/tests/neg-custom-args/captures/i15923.check +++ b/tests/neg-custom-args/captures/i15923.check @@ -2,11 +2,9 @@ 27 | val leak = withCap(cap => mkId(cap)) // error (was: no error here since type aliases don't box) | ^^^^^^^^^^^^^^^^ |Found: (cap: test2.Cap^'s1) ->'s2 [T] => (op: test2.Cap^'s3 ->'s4 T) ->'s5 T - |Required: test2.Cap^{lcap} => [T] => (op²: test2.Cap^'s6 ->'s7 T) ->'s8 T + |Required: test2.Cap^{lcap} => [T] => (op: test2.Cap^'s6 ->'s7 T) ->'s8 T | - |where: => refers to a fresh root capability created in anonymous function of type (using lcap²: scala.caps.Capability): test2.Cap^{lcap²} -> [T] => (op³: test2.Cap^{lcap²} => T) -> T when instantiating expected result type test2.Cap^{lcap} ->{cap²} [T] => (op²: test2.Cap^'s6 ->'s7 T) ->'s8 T of function literal - | op is a reference to a value parameter - | op² is a reference to a value parameter + |where: => refers to a fresh root capability created in anonymous function of type (using lcap: scala.caps.Capability): test2.Cap^{lcap} -> [T] => (op: test2.Cap^{lcap} => T) -> T when instantiating expected result type test2.Cap^{lcap} ->{cap²} [T] => (op: test2.Cap^'s6 ->'s7 T) ->'s8 T of function literal | |Note that capability lcap cannot be included in outer capture set 's1 of parameter cap. | @@ -17,7 +15,7 @@ |Found: (cap: Cap^'s9) ->'s10 Id[Cap^'s11]^'s12 |Required: Cap^{lcap} => Id[Cap^'s13]^'s14 | - |where: => refers to a fresh root capability created in anonymous function of type (using lcap²: scala.caps.Capability): Cap^{lcap²} -> Id[Cap] when instantiating expected result type Cap^{lcap} ->{cap²} Id[Cap^'s13]^'s14 of function literal + |where: => refers to a fresh root capability created in anonymous function of type (using lcap: scala.caps.Capability): Cap^{lcap} -> Id[Cap] when instantiating expected result type Cap^{lcap} ->{cap²} Id[Cap^'s13]^'s14 of function literal | |Note that capability lcap cannot be included in outer capture set 's9 of parameter cap. | From 21562b6cf4c6153e3f2b71dda0124a6e9e4bda48 Mon Sep 17 00:00:00 2001 From: odersky Date: Tue, 12 Aug 2025 15:54:34 +0200 Subject: [PATCH 2/2] Perform subscript disambiguation also for error message addenda --- .../dotty/tools/dotc/cc/CheckCaptures.scala | 24 ++--- .../dotty/tools/dotc/reporting/messages.scala | 10 +- .../tools/dotc/typer/ErrorReporting.scala | 21 ++-- .../dotty/tools/dotc/typer/Implicits.scala | 2 + .../captures/box-adapt-cases.check | 2 + tests/neg-custom-args/captures/byname.check | 6 +- .../captures/capt-depfun.check | 4 +- tests/neg-custom-args/captures/capt1.check | 25 +++-- .../captures/cc-existential-conformance.check | 50 +++++---- tests/neg-custom-args/captures/cc-glb.check | 1 + .../neg-custom-args/captures/cc-poly-2.check | 6 +- tests/neg-custom-args/captures/cc-this.check | 1 + tests/neg-custom-args/captures/cc-this4.check | 5 +- tests/neg-custom-args/captures/cc-this5.check | 1 + .../captures/class-contra.check | 1 + .../captures/class-level-attack.check | 8 +- .../captures/closure-result-typing.check | 5 +- .../neg-custom-args/captures/contracap.check | 5 +- tests/neg-custom-args/captures/dcs-tvar.check | 10 +- .../captures/delayedRunops.check | 2 + .../captures/depfun-reach.check | 24 +++-- .../captures/effect-swaps-explicit.check | 9 +- .../captures/effect-swaps.check | 9 +- tests/neg-custom-args/captures/eta.check | 1 + .../captures/existential-mapping.check | 100 ++++++++++-------- .../captures/extending-cap-classes.check | 11 +- tests/neg-custom-args/captures/filevar.check | 4 +- .../captures/gears-problem.check | 2 + .../captures/heal-tparam-cs.check | 18 +++- tests/neg-custom-args/captures/i15772.check | 8 +- tests/neg-custom-args/captures/i15923.check | 8 +- tests/neg-custom-args/captures/i15923a.check | 5 +- tests/neg-custom-args/captures/i15923b.check | 4 +- tests/neg-custom-args/captures/i16226.check | 20 ++-- tests/neg-custom-args/captures/i19330.check | 11 +- tests/neg-custom-args/captures/i19470.check | 1 + tests/neg-custom-args/captures/i21313.check | 4 +- tests/neg-custom-args/captures/i21347.check | 1 + tests/neg-custom-args/captures/i21401.check | 27 +++-- tests/neg-custom-args/captures/i21614.check | 12 ++- tests/neg-custom-args/captures/i21620.check | 2 + tests/neg-custom-args/captures/i21920.check | 7 +- tests/neg-custom-args/captures/i23207.check | 3 + tests/neg-custom-args/captures/i23431.check | 30 +++--- tests/neg-custom-args/captures/lazylist.check | 5 + .../neg-custom-args/captures/lazylists1.check | 1 + .../neg-custom-args/captures/lazylists2.check | 3 + tests/neg-custom-args/captures/lazyref.check | 4 + .../captures/leak-problem-2.check | 1 + .../captures/leaking-iterators.check | 4 +- tests/neg-custom-args/captures/leaky.check | 3 + tests/neg-custom-args/captures/levels.check | 1 + tests/neg-custom-args/captures/lubs.check | 3 + .../captures/nestedclass.check | 1 + .../neg-custom-args/captures/outer-var.check | 24 +++-- tests/neg-custom-args/captures/reaches.check | 65 +++++++----- tests/neg-custom-args/captures/reaches2.check | 1 + tests/neg-custom-args/captures/readOnly.check | 2 + .../captures/ro-mut-conformance.check | 12 ++- .../captures/scope-extrude-mut.check | 10 +- .../captures/scoped-caps.check | 84 +++++++++------ .../captures/sep-curried.check | 5 +- .../captures/simple-using.check | 4 +- tests/neg-custom-args/captures/try.check | 21 ++-- .../captures/unsound-reach-4.check | 8 +- .../captures/unsound-reach-6.check | 2 + .../captures/unsound-reach.check | 8 +- .../neg-custom-args/captures/use-capset.check | 2 + tests/neg-custom-args/captures/uses.check | 4 + .../captures/usingLogFile.check | 16 +-- .../captures/vars-simple.check | 7 +- tests/neg-custom-args/captures/vars.check | 13 ++- .../captures/widen-reach.check | 24 +++-- tests/neg/i13780-1.check | 4 +- tests/neg/i15998.check | 12 ++- tests/neg/i9568.check | 5 +- .../polymorphic-erased-functions-types.check | 12 +-- tests/neg/polymorphic-functions1.check | 5 +- 78 files changed, 537 insertions(+), 349 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala b/compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala index 2e64e94d4de9..56dcabe8429f 100644 --- a/compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala +++ b/compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala @@ -1079,16 +1079,15 @@ class CheckCaptures extends Recheck, SymTransformer: | Externally visible type: $expected""", tree.srcPos) - def addenda(expected: Type) = new Addenda: - override def toAdd(using Context) = - def result = if tree.isInstanceOf[ValDef] then"" else " result" - i""" - | - |Note that the expected type $expected - |is the previously inferred$result type of $sym - |which is also the type seen in separately compiled sources. - |The new inferred type $tp - |must conform to this type.""" :: Nil + def addenda(expected: Type) = Addenda: + def result = if tree.isInstanceOf[ValDef] then"" else " result" + i""" + | + |Note that the expected type $expected + |is the previously inferred$result type of $sym + |which is also the type seen in separately compiled sources. + |The new inferred type $tp + |must conform to this type.""" tree.tpt match case tpt: InferredTypeTree if !canUseInferred => @@ -1276,6 +1275,7 @@ class CheckCaptures extends Recheck, SymTransformer: else new Addenda: override def toAdd(using Context) = notes.map: note => i""" + | |Note that ${note.description}.""" /** Addendas for error messages that show where we have under-approximated by @@ -1291,13 +1291,11 @@ class CheckCaptures extends Recheck, SymTransformer: (parent, " deep") case _ => (original, "")*/ - add ++ new Addenda: - override def toAdd(using Context): List[String] = + add ++ Addenda: i""" | |Note that a capability $ref in a capture set appearing in contravariant position |was mapped to $mapped which is not a capability. Therefore, it was under-approximated to the empty set.""" - :: Nil case _ => foldOver(add, t) diff --git a/compiler/src/dotty/tools/dotc/reporting/messages.scala b/compiler/src/dotty/tools/dotc/reporting/messages.scala index 210322841158..cf4177ed6466 100644 --- a/compiler/src/dotty/tools/dotc/reporting/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/messages.scala @@ -17,7 +17,7 @@ import ast.Trees import config.{Feature, MigrationVersion, ScalaVersion} import transform.patmat.Space import transform.patmat.SpaceEngine -import typer.ErrorReporting.{err, matchReductionAddendum, substitutableTypeSymbolsInScope} +import typer.ErrorReporting.{err, matchReductionAddendum, substitutableTypeSymbolsInScope, Addenda, NothingToAdd} import typer.ProtoTypes.{ViewProto, SelectionProto, FunProto} import typer.Implicits.* import typer.Inferencing @@ -297,7 +297,7 @@ extends NotFoundMsg(MissingIdentID) { } } -class TypeMismatch(val found: Type, expected: Type, val inTree: Option[untpd.Tree], addenda: => String*)(using Context) +class TypeMismatch(val found: Type, expected: Type, val inTree: Option[untpd.Tree], addenda: Addenda = NothingToAdd)(using Context) extends TypeMismatchMsg(found, expected)(TypeMismatchID): def msg(using Context) = @@ -349,12 +349,12 @@ class TypeMismatch(val found: Type, expected: Type, val inTree: Option[untpd.Tre |Required: $expectedStr${reported.notes}""" end msg - override def msgPostscript(using Context) = + override def msgPostscript(using Context): String = def importSuggestions = if expected.isTopType || found.isBottomType then "" else ctx.typer.importSuggestionAddendum(ViewProto(found.widen, expected)) - super.msgPostscript - ++ addenda.dropWhile(_.isEmpty).headOption.getOrElse(importSuggestions) + + addenda.toAdd.mkString ++ super.msgPostscript ++ importSuggestions override def explain(using Context) = val treeStr = inTree.map(x => s"\nTree:\n\n${x.show}\n").getOrElse("") diff --git a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala index a6254c0d5c00..c3393d39ab05 100644 --- a/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala +++ b/compiler/src/dotty/tools/dotc/typer/ErrorReporting.scala @@ -73,12 +73,16 @@ object ErrorReporting { /** A mixin trait that can produce added elements for an error message */ trait Addenda: - self => - def toAdd(using Context): List[String] = Nil - def ++ (follow: Addenda) = new Addenda: - override def toAdd(using Context) = self.toAdd ++ follow.toAdd + def toAdd(using Context): List[String] + def ++(follow: Addenda) = new Addenda: + def toAdd(using Context) = Addenda.this.toAdd ++ follow.toAdd + + object Addenda: + def apply(msg: Context ?=> String): Addenda = new Addenda: + def toAdd(using Context) = msg :: Nil - object NothingToAdd extends Addenda + object NothingToAdd extends Addenda: + def toAdd(using Context): List[String] = Nil class Errors(using Context) { @@ -195,10 +199,11 @@ object ErrorReporting { def missingElse = tree match case If(_, _, elsep @ Literal(Constant(()))) if elsep.span.isSynthetic => - "\nMaybe you are missing an else part for the conditional?" - case _ => "" + Addenda("\nMaybe you are missing an else part for the conditional?") + case _ => + NothingToAdd - errorTree(tree, TypeMismatch(treeTp, expectedTp, Some(tree), (addenda.toAdd :+ missingElse)*)) + errorTree(tree, TypeMismatch(treeTp, expectedTp, Some(tree), addenda ++ missingElse)) } /** A subtype log explaining why `found` does not conform to `expected` */ diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala index c47d12ba7e88..fbdf6ab80bbf 100644 --- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala +++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala @@ -481,6 +481,8 @@ object Implicits: if (argument.isEmpty) i"match type ${clarify(expectedType)}" else i"convert from ${argument.tpe} to ${clarify(expectedType)}" } + + def toAdd(using Context) = Nil } class NoMatchingImplicits(val expectedType: Type, val argument: Tree, constraint: Constraint = OrderingConstraint.empty) diff --git a/tests/neg-custom-args/captures/box-adapt-cases.check b/tests/neg-custom-args/captures/box-adapt-cases.check index 0e403308ec2f..9173cb629249 100644 --- a/tests/neg-custom-args/captures/box-adapt-cases.check +++ b/tests/neg-custom-args/captures/box-adapt-cases.check @@ -3,6 +3,7 @@ | ^^^^^^^^^^^^^^^^ | Found: (cap: Cap^{io}) ->{io} Int | Required: Cap^{io} -> Int + | | Note that capability io is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^^^^^^^^^^^^^^^^ | Found: (cap: Cap^'s1) ->{io, fs} Int | Required: Cap^{io, fs} ->{io} Int + | | Note that capability fs is not included in capture set {io}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/byname.check b/tests/neg-custom-args/captures/byname.check index 7fbeb6f2ddbe..25b2ef19b17a 100644 --- a/tests/neg-custom-args/captures/byname.check +++ b/tests/neg-custom-args/captures/byname.check @@ -10,16 +10,17 @@ |Found: () ?->{cap1} Int ->{cap1} Int |Required: () ?=> Int ->{cap2} Int | - |where: ?=> refers to a fresh root capability created in method test when checking argument to parameter ff of method h - | |Note that capability cap1 is not included in capture set {cap2}. | + |where: ?=> refers to a fresh root capability created in method test when checking argument to parameter ff of method h + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/byname.scala:19:5 ---------------------------------------- 19 | h(g()) // error | ^^^ | Found: () ?->{cap2} I^'s1 | Required: () ?->{cap1} I + | | Note that capability cap2 is not included in capture set {cap1}. | | longer explanation available when compiling with `-explain` @@ -28,6 +29,7 @@ | ^^^^^^^^^ | Found: () ->{cap2} I^'s2 | Required: () ->{cap1} I + | | Note that capability cap2 is not included in capture set {cap1}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/capt-depfun.check b/tests/neg-custom-args/captures/capt-depfun.check index fe60eea0b886..f2e8911a5f36 100644 --- a/tests/neg-custom-args/captures/capt-depfun.check +++ b/tests/neg-custom-args/captures/capt-depfun.check @@ -4,8 +4,8 @@ | Found: Str^{} ->{ac, y, z} Str^{y, z} | Required: Str^{y, z} => Str^{y, z} | - | where: => refers to a fresh root capability in the type of value dc - | | Note that capability y is not included in capture set {}. | + | where: => refers to a fresh root capability in the type of value dc + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/capt1.check b/tests/neg-custom-args/captures/capt1.check index 9d2ae82d814c..a7d322c74395 100644 --- a/tests/neg-custom-args/captures/capt1.check +++ b/tests/neg-custom-args/captures/capt1.check @@ -3,6 +3,7 @@ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | Found: () ->{x} C | Required: () -> C + | | Note that capability x is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | Found: () ->{x} C^'s1 | Required: Matchable + | | Note that capability x is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -19,6 +21,7 @@ | ^ | Found: (y: Int) ->{x} Int | Required: Matchable + | | Note that capability x is not included in capture set {}. 16 | f | @@ -28,6 +31,7 @@ | ^ | Found: A^{x} | Required: A + | | Note that capability x is not included in capture set {}. 23 | def m() = if x == null then y else y 24 | F(22) @@ -38,6 +42,7 @@ | ^ | Found: A^{x} | Required: A + | | Note that capability x is not included in capture set {}. 28 | def m() = if x == null then y else y | @@ -55,11 +60,13 @@ |Found: () ->'s2 C^ |Required: () -> C^² | - |where: ^ refers to a root capability associated with the result type of (): C^ - | ^² refers to a fresh root capability created in value z2 when checking argument to parameter a of method h + |Note that capability cap is not included in capture set {cap²} + |because cap is not visible from cap² in value z2. | - |Note that capability is not included in capture set {cap} - |because is not visible from cap in value z2. + |where: ^ refers to a root capability associated with the result type of (): C^ + | ^² refers to a fresh root capability created in value z2 when checking argument to parameter a of method h + | cap is a root capability associated with the result type of (): C^ + | cap² is a fresh root capability created in value z2 when checking argument to parameter a of method h | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/capt1.scala:37:5 ----------------------------------------- @@ -68,11 +75,13 @@ |Found: () ->'s3 C^ |Required: () -> C^² | - |where: ^ refers to a root capability associated with the result type of (): C^ - | ^² refers to a fresh root capability created in value z2 when checking argument to parameter b of method h + |Note that capability cap is not included in capture set {cap²} + |because cap is not visible from cap² in value z2. | - |Note that capability is not included in capture set {cap} - |because is not visible from cap in value z2. + |where: ^ refers to a root capability associated with the result type of (): C^ + | ^² refers to a fresh root capability created in value z2 when checking argument to parameter b of method h + | cap is a root capability associated with the result type of (): C^ + | cap² is a fresh root capability created in value z2 when checking argument to parameter b of method h | | longer explanation available when compiling with `-explain` -- Error: tests/neg-custom-args/captures/capt1.scala:38:13 ------------------------------------------------------------- diff --git a/tests/neg-custom-args/captures/cc-existential-conformance.check b/tests/neg-custom-args/captures/cc-existential-conformance.check index c73e4c2e1193..bed763707de5 100644 --- a/tests/neg-custom-args/captures/cc-existential-conformance.check +++ b/tests/neg-custom-args/captures/cc-existential-conformance.check @@ -4,24 +4,31 @@ | Found: (x : A -> (x²: A) -> B^) | Required: A -> A -> B^² | - | where: ^ refers to a root capability associated with the result type of (x²: A): B^ - | ^² refers to a fresh root capability in the type of value y - | x is a value in method test - | x² is a reference to a value parameter + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value y. | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value y. + | where: ^ refers to a root capability associated with the result type of (x²: A): B^ + | ^² refers to a fresh root capability in the type of value y + | cap is a root capability associated with the result type of (x²: A): B^ + | cap² is a fresh root capability in the type of value y + | x is a value in method test + | x² is a reference to a value parameter | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/cc-existential-conformance.scala:9:29 -------------------- 9 | val z: A -> (x: A) -> B^ = y // error | ^ - | Found: A -> A -> B^{y*} - | Required: A -> (x: A) -> B^ + | Found: A -> A -> B^{y*} + | Required: A -> (x: A) -> B^ | - | where: ^ refers to a root capability associated with the result type of (x: A): B^ + | Note that capability y* is not included in capture set {cap}. | - | Note that capability y* is not included in capture set {}. + | Note that the existential capture root in B^² + | cannot subsume the capability y* since that capability is not a `Sharable` capability.. + | + | where: ^ refers to a root capability associated with the result type of (x: A): B^ + | ^² refers to the universal root capability + | cap is a root capability associated with the result type of (x: A): B^ | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/cc-existential-conformance.scala:13:19 ------------------- @@ -30,13 +37,15 @@ | Found: (x : (x²: A) -> B^) | Required: A -> B^² | - | where: ^ refers to a root capability associated with the result type of (x²: A): B^ - | ^² refers to a fresh root capability in the type of value y - | x is a value in method test2 - | x² is a reference to a value parameter + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value y. | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value y. + | where: ^ refers to a root capability associated with the result type of (x²: A): B^ + | ^² refers to a fresh root capability in the type of value y + | cap is a root capability associated with the result type of (x²: A): B^ + | cap² is a fresh root capability in the type of value y + | x is a value in method test2 + | x² is a reference to a value parameter | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/cc-existential-conformance.scala:14:24 ------------------- @@ -45,8 +54,13 @@ | Found: A -> B^{y*} | Required: (x: A) -> B^ | - | where: ^ refers to a root capability associated with the result type of (x: A): B^ + | Note that capability y* is not included in capture set {cap}. + | + | Note that the existential capture root in B^² + | cannot subsume the capability y* since that capability is not a `Sharable` capability.. | - | Note that capability y* is not included in capture set {}. + | where: ^ refers to a root capability associated with the result type of (x: A): B^ + | ^² refers to the universal root capability + | cap is a root capability associated with the result type of (x: A): B^ | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/cc-glb.check b/tests/neg-custom-args/captures/cc-glb.check index eff591ea6ea1..b118736a3fdb 100644 --- a/tests/neg-custom-args/captures/cc-glb.check +++ b/tests/neg-custom-args/captures/cc-glb.check @@ -3,6 +3,7 @@ | ^^ | Found: (x1 : (Foo[T] & Foo[Any])^{io}) | Required: Foo[T] + | | Note that capability io is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/cc-poly-2.check b/tests/neg-custom-args/captures/cc-poly-2.check index 863a3fa98539..1082f2bf7a0b 100644 --- a/tests/neg-custom-args/captures/cc-poly-2.check +++ b/tests/neg-custom-args/captures/cc-poly-2.check @@ -4,16 +4,18 @@ | Found: (d : Test.D^) | Required: Test.D^{c1} | - | where: ^ refers to a fresh root capability in the type of value d - | | Note that capability cap is not included in capture set {c1}. | + | where: ^ refers to a fresh root capability in the type of value d + | cap is a fresh root capability in the type of value d + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/cc-poly-2.scala:16:20 ------------------------------------ 16 | val _: D^{c1} = x // error | ^ | Found: (x : Test.D^{d}) | Required: Test.D^{c1} + | | Note that capability d is not included in capture set {c1}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/cc-this.check b/tests/neg-custom-args/captures/cc-this.check index 672d8f57d3d2..a66e210461ee 100644 --- a/tests/neg-custom-args/captures/cc-this.check +++ b/tests/neg-custom-args/captures/cc-this.check @@ -3,6 +3,7 @@ | ^^^^ | Found: (C.this : C^{C.this.x}) | Required: C + | | Note that capability C.this.x is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/cc-this4.check b/tests/neg-custom-args/captures/cc-this4.check index 4e385b158ce8..1a704c84c77a 100644 --- a/tests/neg-custom-args/captures/cc-this4.check +++ b/tests/neg-custom-args/captures/cc-this4.check @@ -4,8 +4,9 @@ | Found: (C.this : C^) | Required: C | - | where: ^ refers to the universal root capability - | | Note that capability cap is not included in capture set {}. | + | where: ^ refers to the universal root capability + | cap is the universal root capability + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/cc-this5.check b/tests/neg-custom-args/captures/cc-this5.check index 4ff9452a0956..1a291edd15e7 100644 --- a/tests/neg-custom-args/captures/cc-this5.check +++ b/tests/neg-custom-args/captures/cc-this5.check @@ -8,6 +8,7 @@ | ^^^^ | Found: (A.this : A^{c}) | Required: A + | | Note that capability c is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/class-contra.check b/tests/neg-custom-args/captures/class-contra.check index f5ac2ebb219f..f0938f2c4cf0 100644 --- a/tests/neg-custom-args/captures/class-contra.check +++ b/tests/neg-custom-args/captures/class-contra.check @@ -3,6 +3,7 @@ | ^ | Found: (a : T^{x, y}) | Required: T^{k.f} + | | Note that capability x is not included in capture set {k.f}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/class-level-attack.check b/tests/neg-custom-args/captures/class-level-attack.check index e005dca26b29..7b08a8d52538 100644 --- a/tests/neg-custom-args/captures/class-level-attack.check +++ b/tests/neg-custom-args/captures/class-level-attack.check @@ -11,9 +11,11 @@ | Found: IO^{x} | Required: IO^ | - | where: ^ refers to a fresh root capability in the type of value r - | | Note that capability x is not included in capture set {cap} - | because (x : IO^) in method set is not visible from cap in value r. + | because (x : IO^²) in method set is not visible from cap in value r. + | + | where: ^ refers to a fresh root capability in the type of value r + | ^² refers to a fresh root capability in the type of parameter x + | cap is a fresh root capability in the type of value r | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/closure-result-typing.check b/tests/neg-custom-args/captures/closure-result-typing.check index 64ee81dce7b5..7ab0066e9095 100644 --- a/tests/neg-custom-args/captures/closure-result-typing.check +++ b/tests/neg-custom-args/captures/closure-result-typing.check @@ -4,8 +4,9 @@ | Found: (c : Object^) | Required: Object | - | where: ^ refers to a fresh root capability in the type of parameter c - | | Note that capability cap is not included in capture set {}. | + | where: ^ refers to a fresh root capability in the type of parameter c + | cap is a fresh root capability in the type of parameter c + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/contracap.check b/tests/neg-custom-args/captures/contracap.check index a18fb11d4883..ee7078350936 100644 --- a/tests/neg-custom-args/captures/contracap.check +++ b/tests/neg-custom-args/captures/contracap.check @@ -4,8 +4,9 @@ | Found: (f : (Ref[Int]^, Ref[Int]^) -> Unit) | Required: (Ref[Int]^{a}, Ref[Int]^{a}) -> Unit | - | where: ^ refers to the universal root capability - | | Note that capability a is not included in capture set {cap}. | + | where: ^ refers to the universal root capability + | cap is the universal root capability + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/dcs-tvar.check b/tests/neg-custom-args/captures/dcs-tvar.check index f503b16d3656..8ea4e43adcb3 100644 --- a/tests/neg-custom-args/captures/dcs-tvar.check +++ b/tests/neg-custom-args/captures/dcs-tvar.check @@ -4,10 +4,11 @@ | Found: () => Unit | Required: () -> Unit | - | where: => refers to a fresh root capability in the type of type T - | | Note that capability cap is not included in capture set {}. | + | where: => refers to a fresh root capability in the type of type T + | cap is a fresh root capability in the type of type T + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/dcs-tvar.scala:9:2 --------------------------------------- 9 | () => runOps(xs) // error @@ -15,8 +16,9 @@ | Found: () => Unit | Required: () -> Unit | - | where: => refers to a fresh root capability in the type of type U - | | Note that capability cap is not included in capture set {}. | + | where: => refers to a fresh root capability in the type of type U + | cap is a fresh root capability in the type of type U + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/delayedRunops.check b/tests/neg-custom-args/captures/delayedRunops.check index f776f02fa892..df578f4c6146 100644 --- a/tests/neg-custom-args/captures/delayedRunops.check +++ b/tests/neg-custom-args/captures/delayedRunops.check @@ -3,6 +3,7 @@ | ^ | Found: () ->{ops*} Unit | Required: () -> Unit + | | Note that capability ops* is not included in capture set {}. 15 | val ops1 = ops 16 | runOps(ops1) @@ -13,6 +14,7 @@ | ^ | Found: () ->{ops*} Unit | Required: () -> Unit + | | Note that capability ops* is not included in capture set {}. 27 | val ops1: List[() ->{ops*} Unit] = ops 28 | runOps(ops1) diff --git a/tests/neg-custom-args/captures/depfun-reach.check b/tests/neg-custom-args/captures/depfun-reach.check index 310ca9abc2c2..c66910d198ce 100644 --- a/tests/neg-custom-args/captures/depfun-reach.check +++ b/tests/neg-custom-args/captures/depfun-reach.check @@ -4,10 +4,10 @@ |Found: (x$1: (() ->'s1 Unit, () ->'s2 Unit)^'s3) ->'s4 Unit |Required: ((() ->{op*} Unit, () ->{op*} Unit)) => Unit | - |where: => refers to a fresh root capability created in anonymous function of type (): Unit when checking argument to parameter op of method foreach - | |Note that capability op* cannot be included in capture set {} of value f. | + |where: => refers to a fresh root capability created in anonymous function of type (): Unit when checking argument to parameter op of method foreach + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/depfun-reach.scala:19:4 ---------------------------------- 19 | op // error @@ -15,21 +15,25 @@ | Found: (op : (xs: List[(X, () ->{io} Unit)]) => List[() ->{xs*} Unit]) | Required: (xs: List[(X, () ->{io} Unit)]) =>² List[() -> Unit] | - | where: => refers to a fresh root capability in the type of parameter op - | =>² refers to a fresh root capability in the result type of method foo + | Note that capability cap is not included in capture set {cap²}. | - | Note that capability cap is not included in capture set {cap}. + | where: => refers to a fresh root capability in the type of parameter op + | =>² refers to a fresh root capability in the result type of method foo + | cap is a fresh root capability in the type of parameter op + | cap² is a fresh root capability in the result type of method foo | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/depfun-reach.scala:26:60 --------------------------------- 26 | val b: (xs: List[() ->{io} Unit]) => List[() ->{} Unit] = a // error | ^ - | Found: (a : (xs: List[() ->{io} Unit]) => List[() ->{xs*} Unit]) - | Required: (xs: List[() ->{io} Unit]) =>² List[() -> Unit] + | Found: (a : (xs: List[() ->{io} Unit]) => List[() ->{xs*} Unit]) + | Required: (xs: List[() ->{io} Unit]) =>² List[() -> Unit] | - | where: => refers to a fresh root capability in the type of value a - | =>² refers to a fresh root capability in the type of value b + | Note that capability cap is not included in capture set {cap²}. | - | Note that capability cap is not included in capture set {cap}. + | where: => refers to a fresh root capability in the type of value a + | =>² refers to a fresh root capability in the type of value b + | cap is a fresh root capability in the type of value a + | cap² is a fresh root capability in the type of value b | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/effect-swaps-explicit.check b/tests/neg-custom-args/captures/effect-swaps-explicit.check index cd2efbc233c6..d46f9d3bf749 100644 --- a/tests/neg-custom-args/captures/effect-swaps-explicit.check +++ b/tests/neg-custom-args/captures/effect-swaps-explicit.check @@ -4,6 +4,7 @@ | ^ | Found: Result.Ok[Future[T^'s1]^{fr, contextual$1}] | Required: Result[Future[T], Nothing] + | | Note that capability fr is not included in capture set {}. 65 | fr.await.ok |-------------------------------------------------------------------------------------------------------------------- @@ -21,10 +22,10 @@ |Found: (contextual$9: boundary.Label[Result[Future[T^'s2]^'s3, E^'s4]^'s5]^'s6) ?->{fr, async} Future[T^'s7]^{fr, contextual$9} |Required: (boundary.Label[Result[Future[T^'s8]^'s9, E^'s10]]^) ?=> Future[T^'s8]^'s9 | + |Note that capability contextual$9 cannot be included in outer capture set 's9. + | |where: ?=> refers to a fresh root capability created in method fail4 when checking argument to parameter body of method make | ^ refers to the universal root capability - | - |Note that capability contextual$9 cannot be included in outer capture set 's9. 70 | fr.await.ok | | longer explanation available when compiling with `-explain` @@ -34,10 +35,10 @@ |Found: (lbl: boundary.Label[Result[Future[T^'s11]^'s12, E^'s13]^'s14]^'s15) ?->{fr, async} Future[T^'s16]^{fr, lbl} |Required: (boundary.Label[Result[Future[T], E]]^) ?=> Future[T] | + |Note that capability fr is not included in capture set {}. + | |where: ?=> refers to a fresh root capability created in method fail5 when checking argument to parameter body of method make | ^ refers to the universal root capability - | - |Note that capability fr is not included in capture set {}. 74 | Future: fut ?=> 75 | fr.await.ok | diff --git a/tests/neg-custom-args/captures/effect-swaps.check b/tests/neg-custom-args/captures/effect-swaps.check index b9bcfdfa667d..2148de702501 100644 --- a/tests/neg-custom-args/captures/effect-swaps.check +++ b/tests/neg-custom-args/captures/effect-swaps.check @@ -4,6 +4,7 @@ | ^ | Found: Result.Ok[Future[T^'s1]^{fr, contextual$1}] | Required: Result[Future[T], Nothing] + | | Note that capability fr is not included in capture set {}. 65 | fr.await.ok |-------------------------------------------------------------------------------------------------------------------- @@ -21,10 +22,10 @@ |Found: (contextual$9: boundary.Label[Result[Future[T^'s2]^'s3, E^'s4]^'s5]^'s6) ?->{fr, async} Future[T^'s7]^{fr, contextual$9} |Required: (boundary.Label[Result[Future[T^'s8]^'s9, E^'s10]]^) ?=> Future[T^'s8]^'s9 | + |Note that capability contextual$9 cannot be included in outer capture set 's9. + | |where: ?=> refers to a fresh root capability created in method fail4 when checking argument to parameter body of method make | ^ refers to the universal root capability - | - |Note that capability contextual$9 cannot be included in outer capture set 's9. 70 | fr.await.ok | | longer explanation available when compiling with `-explain` @@ -34,10 +35,10 @@ |Found: (lbl: boundary.Label[Result[Future[T^'s11]^'s12, E^'s13]^'s14]^'s15) ?->{fr, async} Future[T^'s16]^{fr, lbl} |Required: (boundary.Label[Result[Future[T], E]]^) ?=> Future[T] | + |Note that capability fr is not included in capture set {}. + | |where: ?=> refers to a fresh root capability created in method fail5 when checking argument to parameter body of method make | ^ refers to the universal root capability - | - |Note that capability fr is not included in capture set {}. 74 | Future: fut ?=> 75 | fr.await.ok | diff --git a/tests/neg-custom-args/captures/eta.check b/tests/neg-custom-args/captures/eta.check index bc11637022b0..dfce53accd4d 100644 --- a/tests/neg-custom-args/captures/eta.check +++ b/tests/neg-custom-args/captures/eta.check @@ -3,6 +3,7 @@ | ^ | Found: (g : () -> A) | Required: () -> Proc^{f} + | | Note that capability f is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/existential-mapping.check b/tests/neg-custom-args/captures/existential-mapping.check index 5813437c53bd..53999323a742 100644 --- a/tests/neg-custom-args/captures/existential-mapping.check +++ b/tests/neg-custom-args/captures/existential-mapping.check @@ -11,10 +11,11 @@ | Found: (x1 : (x: C^) -> C^²) | Required: (x: C^) -> C | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: C^): C^² + | Note that capability cap is not included in capture set {}. | - | Note that capability is not included in capture set {}. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: C^): C^² + | cap is a root capability associated with the result type of (x: C^): C^² | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:12:20 -------------------------- @@ -23,21 +24,22 @@ | Found: C^ -> C^{x2*} | Required: C^ -> C | - | where: ^ refers to the universal root capability - | | Note that capability x2* is not included in capture set {}. | + | where: ^ refers to the universal root capability + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:15:30 -------------------------- 15 | val _: A^ -> (x: C^) -> C = x3 // error | ^^ - | Found: (x3 : A^ -> (x: C^) -> C^²) - | Required: A^ -> (x: C^) -> C + | Found: (x3 : A^ -> (x: C^) -> C^²) + | Required: A^ -> (x: C^) -> C | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: C^): C^² + | Note that capability cap is not included in capture set {}. | - | Note that capability is not included in capture set {}. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: C^): C^² + | cap is a root capability associated with the result type of (x: C^): C^² | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:18:25 -------------------------- @@ -46,48 +48,52 @@ | Found: A^ -> C^ -> C^{x4*} | Required: A^ -> C^ -> C | - | where: ^ refers to the universal root capability - | | Note that capability x4* is not included in capture set {}. | + | where: ^ refers to the universal root capability + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:21:30 -------------------------- 21 | val _: A^ -> (x: C^) -> C = x5 // error | ^^ - | Found: (x5 : A^ -> (x: C^) -> C^²) - | Required: A^ -> (x: C^) -> C + | Found: (x5 : A^ -> (x: C^) -> C^²) + | Required: A^ -> (x: C^) -> C | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: C^): C^² + | Note that capability cap is not included in capture set {}. | - | Note that capability is not included in capture set {}. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: C^): C^² + | cap is a root capability associated with the result type of (x: C^): C^² | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:24:30 -------------------------- 24 | val _: A^ -> (x: C^) => C = x6 // error | ^^ - | Found: A^ -> (x: C^) ->{x6*} C^² - | Required: A^ -> (x: C^) => C + | Found: A^ -> (x: C^) ->{x6*} C^² + | Required: A^ -> (x: C^) => C | - | where: => refers to a fresh root capability in the type of value _$6 - | ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: C^): C^² + | Note that capability cap is not included in capture set {}. | - | Note that capability is not included in capture set {}. + | where: => refers to a fresh root capability in the type of value _$6 + | ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: C^): C^² + | cap is a root capability associated with the result type of (x: C^): C^² | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:27:25 -------------------------- 27 | val _: (x: C^) => C = y1 // error | ^^ - | Found: (y1 : (x: C^) => C^²) - | Required: (x: C^) =>² C + | Found: (y1 : (x: C^) => C^²) + | Required: (x: C^) =>² C | - | where: => refers to a fresh root capability in the type of value y1 - | =>² refers to a fresh root capability in the type of value _$7 - | ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: C^): C^² + | Note that capability cap is not included in capture set {cap²}. | - | Note that capability cap is not included in capture set {cap}. + | where: => refers to a fresh root capability in the type of value y1 + | =>² refers to a fresh root capability in the type of value _$7 + | ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: C^): C^² + | cap is a fresh root capability in the type of value y1 + | cap² is a fresh root capability in the type of value _$7 | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:30:20 -------------------------- @@ -96,11 +102,11 @@ | Found: C^ ->{y2} C^{y2*} | Required: C^ => C | + | Note that capability y2* is not included in capture set {}. + | | where: => refers to a fresh root capability in the type of value _$8 | ^ refers to the universal root capability | - | Note that capability y2* is not included in capture set {}. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:33:30 -------------------------- 33 | val _: A^ => (x: C^) => C = y3 // error @@ -108,12 +114,13 @@ | Found: A^ ->{y3} (x: C^) ->{y3*} C^² | Required: A^ => (x: C^) =>² C | + | Note that capability cap is not included in capture set {}. + | | where: => refers to a fresh root capability in the type of value _$9 | =>² refers to a fresh root capability in the type of value _$9 | ^ refers to the universal root capability | ^² refers to a root capability associated with the result type of (x: C^): C^² - | - | Note that capability is not included in capture set {}. + | cap is a root capability associated with the result type of (x: C^): C^² | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:36:25 -------------------------- @@ -122,25 +129,27 @@ | Found: A^ ->{y4} C^ ->{y4*} C^{y4*} | Required: A^ => C^ =>² C | + | Note that capability y4* is not included in capture set {}. + | | where: => refers to a fresh root capability in the type of value _$10 | =>² refers to a fresh root capability in the type of value _$10 | ^ refers to the universal root capability | - | Note that capability y4* is not included in capture set {}. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:39:30 -------------------------- 39 | val _: A^ => (x: C^) -> C = y5 // error | ^^ - | Found: (y5 : A^ => (x: C^) -> C^²) - | Required: A^ =>² (x: C^) -> C + | Found: (y5 : A^ => (x: C^) -> C^²) + | Required: A^ =>² (x: C^) -> C | - | where: => refers to a fresh root capability in the type of value y5 - | =>² refers to a fresh root capability in the type of value _$11 - | ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: C^): C^² + | Note that capability cap is not included in capture set {cap²}. | - | Note that capability cap is not included in capture set {cap}. + | where: => refers to a fresh root capability in the type of value y5 + | =>² refers to a fresh root capability in the type of value _$11 + | ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: C^): C^² + | cap is a fresh root capability in the type of value y5 + | cap² is a fresh root capability in the type of value _$11 | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/existential-mapping.scala:42:30 -------------------------- @@ -149,11 +158,12 @@ | Found: A^ ->{y6} (x: C^) ->{y6*} C^² | Required: A^ => (x: C^) =>² C | + | Note that capability cap is not included in capture set {}. + | | where: => refers to a fresh root capability in the type of value _$12 | =>² refers to a fresh root capability in the type of value _$12 | ^ refers to the universal root capability | ^² refers to a root capability associated with the result type of (x: C^): C^² - | - | Note that capability is not included in capture set {}. + | cap is a root capability associated with the result type of (x: C^): C^² | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/extending-cap-classes.check b/tests/neg-custom-args/captures/extending-cap-classes.check index 798522638888..be0e94316f71 100644 --- a/tests/neg-custom-args/captures/extending-cap-classes.check +++ b/tests/neg-custom-args/captures/extending-cap-classes.check @@ -4,10 +4,10 @@ |Found: C2^{cap.rd} |Required: C1 | - |where: cap is a fresh root capability classified as SharedCapability created in value x2 when constructing Capability instance C2 - | |Note that capability cap.rd is not included in capture set {}. | + |where: cap is a fresh root capability classified as SharedCapability created in value x2 when constructing Capability instance C2 + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/extending-cap-classes.scala:8:15 ------------------------- 8 | val x3: C1 = new C3 // error @@ -15,16 +15,19 @@ |Found: C3^{cap.rd} |Required: C1 | - |where: cap is a fresh root capability classified as SharedCapability created in value x3 when constructing Capability instance C3 - | |Note that capability cap.rd is not included in capture set {}. | + |where: cap is a fresh root capability classified as SharedCapability created in value x3 when constructing Capability instance C3 + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/extending-cap-classes.scala:13:15 ------------------------ 13 | val z2: C1 = y2 // error | ^^ | Found: (y2 : C2) | Required: C1 + | | Note that capability cap is not included in capture set {}. | + | where: cap is a fresh root capability classified as SharedCapability in the type of value y2 + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/filevar.check b/tests/neg-custom-args/captures/filevar.check index 565b78b9aa0b..ebdfdd24d31e 100644 --- a/tests/neg-custom-args/captures/filevar.check +++ b/tests/neg-custom-args/captures/filevar.check @@ -4,9 +4,9 @@ |Found: (f: File^'s1) ->'s2 Unit |Required: (f: File^{l}) => Unit | - |where: => refers to a fresh root capability created in anonymous function of type (using l: scala.caps.Capability): File^{l} -> Unit when instantiating expected result type (f: File^{l}) ->{cap} Unit of function literal - | |Note that capability l cannot be included in outer capture set 's1 of parameter f. + | + |where: => refers to a fresh root capability created in anonymous function of type (using l: scala.caps.Capability): File^{l} -> Unit when instantiating expected result type (f: File^{l}) ->{cap} Unit of function literal 16 | val o = Service() 17 | o.file = f 18 | o.log diff --git a/tests/neg-custom-args/captures/gears-problem.check b/tests/neg-custom-args/captures/gears-problem.check index 291986f130a8..c4b0eb83fc22 100644 --- a/tests/neg-custom-args/captures/gears-problem.check +++ b/tests/neg-custom-args/captures/gears-problem.check @@ -3,6 +3,7 @@ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | Found: Future[T]^{collector.futures*} | Required: Future[T]^{C} + | | Note that capability collector.futures* is not included in capture set {C}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^^^^^ | Found: Future[T^{}]^{collector.futures*} | Required: Future[T]^{C} + | | Note that capability collector.futures* is not included in capture set {C}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/heal-tparam-cs.check b/tests/neg-custom-args/captures/heal-tparam-cs.check index 2d5ee98059f3..efc0a3f168b2 100644 --- a/tests/neg-custom-args/captures/heal-tparam-cs.check +++ b/tests/neg-custom-args/captures/heal-tparam-cs.check @@ -4,10 +4,10 @@ |Found: (c: Capp^'s1) ->'s2 () ->{c} Unit |Required: (c: Capp^) => () ->'s3 Unit | + |Note that capability c cannot be included in outer capture set 's3. + | |where: => refers to a fresh root capability created in value test1 when checking argument to parameter op of method localCap | ^ refers to the universal root capability - | - |Note that capability c cannot be included in outer capture set 's3. 11 | () => { c.use() } 12 | } | @@ -18,10 +18,15 @@ | Found: (x$0: Capp^'s4) ->'s5 () ->{x$0} Unit | Required: (c: Capp^) -> () => Unit | - | where: => refers to a root capability associated with the result type of (c: Capp^): () => Unit - | ^ refers to the universal root capability + | Note that capability x$0 is not included in capture set {cap}. | - | Note that capability x$0 is not included in capture set {{x$0} Unit>}. + | Note that the existential capture root in () =>² Unit + | cannot subsume the capability (x$0 : Capp^'s4) since that capability is not a `Sharable` capability.. + | + | where: => refers to a root capability associated with the result type of (c: Capp^): () => Unit + | =>² refers to the universal root capability + | ^ refers to the universal root capability + | cap is a root capability associated with the result type of (x$0: Capp^'s4): () ->{x$0} Unit 16 | (c1: Capp^) => () => { c1.use() } 17 | } | @@ -31,6 +36,7 @@ | ^ | Found: (x$0: Capp^'s6) ->'s7 () ->{x$0} Unit | Required: (c: Capp^{io}) -> () ->{net} Unit + | | Note that capability x$0 is not included in capture set {net}. 26 | (c1: Capp^{io}) => () => { c1.use() } 27 | } @@ -41,6 +47,7 @@ | ^^^^^^^^^^^^^^ | Found: () ->{io} Unit | Required: () -> Unit + | | Note that capability io is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -49,6 +56,7 @@ | ^^^^^^^^^^^^^^ | Found: () ->{io} Unit | Required: () -> Unit + | | Note that capability io is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i15772.check b/tests/neg-custom-args/captures/i15772.check index d285e2715aa7..385629d33e89 100644 --- a/tests/neg-custom-args/captures/i15772.check +++ b/tests/neg-custom-args/captures/i15772.check @@ -24,12 +24,13 @@ |Found: (C{val arg: C^}^² => Unit) -> Unit |Required: (C => Unit) =>² Unit | + |Note that capability cap is not included in capture set {}. + | |where: => refers to the universal root capability | =>² refers to a fresh root capability in the type of value boxed2 | ^ refers to a fresh root capability in the type of value arg - | ^² refers to a fresh root capability created in value boxed2 when instantiating method c's type -> C^{cap} - | - |Note that capability cap is not included in capture set {}. + | ^² refers to a fresh root capability created in value boxed2 when instantiating method c's type -> C^{cap²} + | cap is a fresh root capability created in value boxed2 when instantiating method c's type -> C^{cap²} | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i15772.scala:46:2 ---------------------------------------- @@ -37,6 +38,7 @@ | ^ | Found: (x : () ->{filesList, sayHello} Unit) | Required: () -> Unit + | | Note that capability filesList is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i15923.check b/tests/neg-custom-args/captures/i15923.check index 900098266707..3e4a97509237 100644 --- a/tests/neg-custom-args/captures/i15923.check +++ b/tests/neg-custom-args/captures/i15923.check @@ -4,10 +4,10 @@ |Found: (cap: test2.Cap^'s1) ->'s2 [T] => (op: test2.Cap^'s3 ->'s4 T) ->'s5 T |Required: test2.Cap^{lcap} => [T] => (op: test2.Cap^'s6 ->'s7 T) ->'s8 T | - |where: => refers to a fresh root capability created in anonymous function of type (using lcap: scala.caps.Capability): test2.Cap^{lcap} -> [T] => (op: test2.Cap^{lcap} => T) -> T when instantiating expected result type test2.Cap^{lcap} ->{cap²} [T] => (op: test2.Cap^'s6 ->'s7 T) ->'s8 T of function literal - | |Note that capability lcap cannot be included in outer capture set 's1 of parameter cap. | + |where: => refers to a fresh root capability created in anonymous function of type (using lcap: scala.caps.Capability): test2.Cap^{lcap} -> [T] => (op: test2.Cap^{lcap} => T) -> T when instantiating expected result type test2.Cap^{lcap} ->{cap²} [T] => (op: test2.Cap^'s6 ->'s7 T) ->'s8 T of function literal + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i15923.scala:12:21 --------------------------------------- 12 | val leak = withCap(cap => mkId(cap)) // error @@ -15,10 +15,10 @@ |Found: (cap: Cap^'s9) ->'s10 Id[Cap^'s11]^'s12 |Required: Cap^{lcap} => Id[Cap^'s13]^'s14 | - |where: => refers to a fresh root capability created in anonymous function of type (using lcap: scala.caps.Capability): Cap^{lcap} -> Id[Cap] when instantiating expected result type Cap^{lcap} ->{cap²} Id[Cap^'s13]^'s14 of function literal - | |Note that capability lcap cannot be included in outer capture set 's9 of parameter cap. | + |where: => refers to a fresh root capability created in anonymous function of type (using lcap: scala.caps.Capability): Cap^{lcap} -> Id[Cap] when instantiating expected result type Cap^{lcap} ->{cap²} Id[Cap^'s13]^'s14 of function literal + | | longer explanation available when compiling with `-explain` -- Warning: tests/neg-custom-args/captures/i15923.scala:21:56 ---------------------------------------------------------- 21 | def withCap[X](op: (lcap: caps.Capability) ?-> Cap^{lcap} => X): X = { diff --git a/tests/neg-custom-args/captures/i15923a.check b/tests/neg-custom-args/captures/i15923a.check index 0971b025f653..bc2495391625 100644 --- a/tests/neg-custom-args/captures/i15923a.check +++ b/tests/neg-custom-args/captures/i15923a.check @@ -4,10 +4,11 @@ |Found: (lcap: Cap^'s1) ->'s2 () ->'s3 Id[Cap^'s4]^'s5 |Required: (lcap: Cap^) => () =>² Id[Cap^'s6]^'s7 | + |Note that capability cap cannot be included in outer capture set 's6. + | |where: => refers to a fresh root capability created in value leak when checking argument to parameter op of method withCap | =>² refers to a root capability associated with the result type of (lcap: Cap^): () =>² Id[Cap^'s6]^'s7 | ^ refers to the universal root capability - | - |Note that capability cannot be included in outer capture set 's6. + | cap is a root capability associated with the result type of (): Id[Cap^'s4]^'s5 | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i15923b.check b/tests/neg-custom-args/captures/i15923b.check index cba83424a4ca..5078b97a66db 100644 --- a/tests/neg-custom-args/captures/i15923b.check +++ b/tests/neg-custom-args/captures/i15923b.check @@ -4,9 +4,9 @@ |Found: (x$0: Cap^) -> Id[Cap^{x$0}] |Required: (lcap: Cap^) => Id[Cap^'s1]^'s2 | + |Note that capability lcap cannot be included in outer capture set 's1. + | |where: => refers to a fresh root capability created in value leak when checking argument to parameter op of method withCap | ^ refers to the universal root capability | - |Note that capability lcap cannot be included in outer capture set 's1. - | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i16226.check b/tests/neg-custom-args/captures/i16226.check index 7cd8b91aa076..76111efa2a32 100644 --- a/tests/neg-custom-args/captures/i16226.check +++ b/tests/neg-custom-args/captures/i16226.check @@ -5,14 +5,15 @@ | LazyRef[B^'s9]{val elem: () => B^'s10}^{f1, ref1} |Required: (LazyRef[A]^{io}, A =>² B) =>³ LazyRef[B]^ | + |Note that capability f1 is not included in capture set {cap} + |because (f1 : A^'s5 ->'s6 B^'s7) is not visible from cap in method mapc. + | |where: => refers to a root capability associated with the result type of (ref1: LazyRef[A^'s1]{val elem: () ->'s2 A^'s3}^'s4, f1: A^'s5 ->'s6 B^'s7): | LazyRef[B^'s9]{val elem: () => B^'s10}^{f1, ref1} | =>² refers to the universal root capability | =>³ refers to a fresh root capability in the result type of method mapc | ^ refers to a fresh root capability in the result type of method mapc - | - |Note that capability f1 is not included in capture set {cap} - |because (f1 : A^'s5 ->'s6 B^'s7) is not visible from cap in method mapc. + | cap is a fresh root capability in the result type of method mapc | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i16226.scala:15:4 ---------------------------------------- @@ -22,15 +23,18 @@ | LazyRef[B^'s19]{val elem: () => B^'s20}^{f1, ref1} |Required: (ref: LazyRef[A]^{io}, f: A =>² B) =>³ LazyRef[B]^ | + |Note that capability f1 is not included in capture set {cap}. + | + |Note that the existential capture root in LazyRef[B]^² + |cannot subsume the capability (f1 : A^'s15 ->'s16 B^'s17) since that capability is not a `Sharable` capability.. + | |where: => refers to a root capability associated with the result type of (ref1: LazyRef[A^'s11]{val elem: () ->'s12 A^'s13}^'s14, f1: A^'s15 ->'s16 B^'s17): | LazyRef[B^'s19]{val elem: () => B^'s20}^{f1, ref1} | =>² refers to the universal root capability | =>³ refers to a fresh root capability in the result type of method mapd | ^ refers to a root capability associated with the result type of (ref: LazyRef[A]^{io}, f: A =>² B): LazyRef[B]^ - | - |Note that capability f1 is not included in capture set {'s12 A^'s13}^'s14, f1: A^'s15 ->'s16 B^'s17): - | LazyRef[B^'s19]{val elem: () => B^'s20}^{f1, ref1} - |>}. + | ^² refers to the universal root capability + | cap is a root capability associated with the result type of (ref1: LazyRef[A^'s11]{val elem: () ->'s12 A^'s13}^'s14, f1: A^'s15 ->'s16 B^'s17): + | LazyRef[B^'s19]{val elem: () => B^'s20}^{f1, ref1} | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i19330.check b/tests/neg-custom-args/captures/i19330.check index 88219f0ffa83..e142d6dbddb0 100644 --- a/tests/neg-custom-args/captures/i19330.check +++ b/tests/neg-custom-args/captures/i19330.check @@ -8,6 +8,7 @@ | ^ | Found: () ->{t} Logger^{t*} | Required: x.T + | | Note that capability t is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -17,11 +18,13 @@ | Found: bar.T | Required: () => Logger^ | - | where: => refers to a fresh root capability in the type of value bad - | ^ refers to a fresh root capability in the type of value bad + | Note that capability cap is not included in capture set {cap²} + | because cap in class Bar is not visible from cap² in value bad. | - | Note that capability cap is not included in capture set {cap} - | because cap in class Bar is not visible from cap in value bad. + | where: => refers to a fresh root capability in the type of value bad + | ^ refers to a fresh root capability in the type of value bad + | cap is a fresh root capability in the type of type T + | cap² is a fresh root capability in the type of value bad | | longer explanation available when compiling with `-explain` -- Error: tests/neg-custom-args/captures/i19330.scala:16:14 ------------------------------------------------------------ diff --git a/tests/neg-custom-args/captures/i19470.check b/tests/neg-custom-args/captures/i19470.check index b1279c9f1ef1..fc56db33ffe2 100644 --- a/tests/neg-custom-args/captures/i19470.check +++ b/tests/neg-custom-args/captures/i19470.check @@ -3,6 +3,7 @@ | ^^^^^^^^ | Found: Inv[IO^{f?}] | Required: Inv[IO^'s1]^'s2 + | | Note that capability f is not included in capture set {f?}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i21313.check b/tests/neg-custom-args/captures/i21313.check index c1af867788af..645b33053146 100644 --- a/tests/neg-custom-args/captures/i21313.check +++ b/tests/neg-custom-args/captures/i21313.check @@ -8,8 +8,8 @@ |Found: (src2 : Source[Int, scala.caps.CapSet^{ac2}]^{}) |Required: Source[Int, scala.caps.CapSet^{ac1}]^ | - |where: ^ refers to a fresh root capability created in method test when checking argument to parameter src of method await - | |Note that capability ac1 cannot be included in capture set {ac2} of value src2. | + |where: ^ refers to a fresh root capability created in method test when checking argument to parameter src of method await + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i21347.check b/tests/neg-custom-args/captures/i21347.check index 39f97eed7539..a4c90c7a70f2 100644 --- a/tests/neg-custom-args/captures/i21347.check +++ b/tests/neg-custom-args/captures/i21347.check @@ -3,6 +3,7 @@ | ^^^^^^^^^^^^^^^^^^^^^^ | Found: () ->{f} Unit | Required: () -> Unit + | | Note that capability f is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i21401.check b/tests/neg-custom-args/captures/i21401.check index a8dfba1296c9..ae82cd8f08fd 100644 --- a/tests/neg-custom-args/captures/i21401.check +++ b/tests/neg-custom-args/captures/i21401.check @@ -18,13 +18,14 @@ |Found: (x: IO^'s1) ->'s2 IO^{x} |Required: IO^ => IO^² | - |where: => refers to a fresh root capability created in value a when checking argument to parameter op of method usingIO - | ^ refers to the universal root capability - | ^² refers to a fresh root capability created in value a when checking argument to parameter op of method usingIO - | |Note that capability x is not included in capture set {cap} |because (x : IO^'s1) is not visible from cap in value a. | + |where: => refers to a fresh root capability created in value a when checking argument to parameter op of method usingIO + | ^ refers to the universal root capability + | ^² refers to a fresh root capability created in value a when checking argument to parameter op of method usingIO + | cap is a fresh root capability created in value a when checking argument to parameter op of method usingIO + | | longer explanation available when compiling with `-explain` -- Error: tests/neg-custom-args/captures/i21401.scala:16:66 ------------------------------------------------------------ 16 | val leaked: [R, X <: Boxed[IO^] -> R] -> (op: X) -> R = usingIO[Res](mkRes) // error @@ -50,14 +51,18 @@ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i21401.scala:17:67 --------------------------------------- 17 | val x: Boxed[IO^] = leaked[Boxed[IO^], Boxed[IO^] -> Boxed[IO^]](x => x) // error // error // error | ^^^^^^ - | Found: (x: Boxed[IO^]^'s3) ->'s4 Boxed[IO^²] - | Required: Boxed[IO^] -> Boxed[IO^³] + | Found: (x: Boxed[IO^]^'s3) ->'s4 Boxed[IO^²] + | Required: Boxed[IO^] -> Boxed[IO^³] | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: Boxed[IO^]^'s3): Boxed[IO^²] - | ^³ refers to a fresh root capability created in value x² + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value x². | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value x. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: Boxed[IO^]^'s3): Boxed[IO^²] + | ^³ refers to a fresh root capability created in value x² + | cap is a root capability associated with the result type of (x: Boxed[IO^]^'s3): Boxed[IO^²] + | cap² is a fresh root capability created in value x² + | x is a reference to a value parameter + | x² is a value in method test2 | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i21614.check b/tests/neg-custom-args/captures/i21614.check index dfc4f9ce2e40..f7938c16b9b5 100644 --- a/tests/neg-custom-args/captures/i21614.check +++ b/tests/neg-custom-args/captures/i21614.check @@ -4,9 +4,11 @@ |Found: (f : F) |Required: File^ | - |where: ^ refers to a fresh root capability classified as SharedCapability created in anonymous function of type (f²: F): Logger when checking argument to parameter f of constructor Logger + |Note that capability cap is not included in capture set {cap²}. | - |Note that capability cap is not included in capture set {cap}. + |where: ^ refers to a fresh root capability classified as SharedCapability created in anonymous function of type (f²: F): Logger when checking argument to parameter f of constructor Logger + | cap is a fresh root capability classified as SharedCapability in the type of parameter f + | cap² is a fresh root capability classified as SharedCapability created in anonymous function of type (f²: F): Logger when checking argument to parameter f of constructor Logger | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i21614.scala:15:12 --------------------------------------- @@ -15,10 +17,10 @@ |Found: (_$1: File^'s1) ->{C} Logger{val f: File^{_$1}}^{cap.rd, _$1} |Required: File^{C} => Logger{val f: File^'s2}^'s3 | - |where: => refers to a fresh root capability created in method mkLoggers2 when checking argument to parameter f of method map - | cap is a root capability associated with the result type of (_$1: File^'s1): Logger{val f: File^{_$1}}^{cap.rd, _$1} - | |Note that capability C is not classified as trait SharedCapability, therefore it |cannot be included in capture set 's1 of parameter _$1 of SharedCapability elements. | + |where: => refers to a fresh root capability created in method mkLoggers2 when checking argument to parameter f of method map + | cap is a root capability associated with the result type of (_$1: File^'s1): Logger{val f: File^{_$1}}^{cap.rd, _$1} + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i21620.check b/tests/neg-custom-args/captures/i21620.check index d5c99ede02ec..b5a925e7f62c 100644 --- a/tests/neg-custom-args/captures/i21620.check +++ b/tests/neg-custom-args/captures/i21620.check @@ -15,6 +15,7 @@ | ^ | Found: (f : () ->{x} () ->{x} Unit) | Required: () -> () ->{x} Unit + | | Note that capability x is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -23,6 +24,7 @@ | ^ | Found: (f : () ->{x} () ->{x} Unit) | Required: () -> () ->{x} Unit + | | Note that capability x is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i21920.check b/tests/neg-custom-args/captures/i21920.check index 66994fc36122..c9b1aa276d93 100644 --- a/tests/neg-custom-args/captures/i21920.check +++ b/tests/neg-custom-args/captures/i21920.check @@ -4,9 +4,10 @@ |Found: (f: File^'s1) ->'s2 Cell[File^'s3]{val head: () ->'s4 IterableOnce[File^'s5]^'s6}^'s7 |Required: File^ => Cell[File^'s8]{val head: () ->'s9 IterableOnce[File^'s10]^'s11}^'s12 | - |where: => refers to a fresh root capability created in value cell when checking argument to parameter f of method open - | ^ refers to the universal root capability + |Note that capability cap cannot be included in outer capture set 's13. | - |Note that capability cannot be included in outer capture set 's13. + |where: => refers to a fresh root capability created in value cell when checking argument to parameter f of method open + | ^ refers to the universal root capability + | cap is a root capability associated with the result type of (): IterableOnce[File^'s13]^² | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/i23207.check b/tests/neg-custom-args/captures/i23207.check index cc41779b6b47..6300857c612f 100644 --- a/tests/neg-custom-args/captures/i23207.check +++ b/tests/neg-custom-args/captures/i23207.check @@ -3,6 +3,7 @@ | ^^^^^ | Found: (box.x : (b : B^{io})^{b}) | Required: A + | | Note that capability io is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^ | Found: (c : B^{b}) | Required: A + | | Note that capability b is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -19,6 +21,7 @@ | ^ | Found: A^{io} | Required: A + | | Note that capability io is not included in capture set {}. 24 | val hide: AnyRef^{io} = io 25 | val b = new B diff --git a/tests/neg-custom-args/captures/i23431.check b/tests/neg-custom-args/captures/i23431.check index 34f8e3beac72..624a3b63cb09 100644 --- a/tests/neg-custom-args/captures/i23431.check +++ b/tests/neg-custom-args/captures/i23431.check @@ -4,11 +4,13 @@ | Found: (io : IO^) | Required: IO^² | - | where: ^ refers to a fresh root capability in the type of parameter io - | ^² refers to a fresh root capability in the type of variable myIO + | Note that capability cap is not included in capture set {cap²} + | because cap in method setIO is not visible from cap² in variable myIO. | - | Note that capability cap is not included in capture set {cap} - | because cap in method setIO is not visible from cap in variable myIO. + | where: ^ refers to a fresh root capability in the type of parameter io + | ^² refers to a fresh root capability in the type of variable myIO + | cap is a fresh root capability in the type of parameter io + | cap² is a fresh root capability in the type of variable myIO | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i23431.scala:11:13 --------------------------------------- @@ -17,11 +19,13 @@ | Found: (io2 : IO^) | Required: IO^² | - | where: ^ refers to a fresh root capability in the type of parameter io2 - | ^² refers to a fresh root capability in the type of variable myIO + | Note that capability cap is not included in capture set {cap²} + | because cap in enclosing function is not visible from cap² in variable myIO. | - | Note that capability cap is not included in capture set {cap} - | because cap in enclosing function is not visible from cap in variable myIO. + | where: ^ refers to a fresh root capability in the type of parameter io2 + | ^² refers to a fresh root capability in the type of variable myIO + | cap is a fresh root capability in the type of parameter io2 + | cap² is a fresh root capability in the type of variable myIO | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/i23431.scala:12:12 --------------------------------------- @@ -30,11 +34,13 @@ |Found: (io3: IO^'s1) ->'s2 Unit |Required: IO^ => Unit | - |where: => refers to a fresh root capability created in anonymous function of type (io1: IO^): Unit when checking argument to parameter op of method withIO - | ^ refers to the universal root capability + |Note that capability cap is not included in capture set {cap²} + |because cap in enclosing function is not visible from cap² in variable myIO. | - |Note that capability cap is not included in capture set {cap} - |because cap in enclosing function is not visible from cap in variable myIO. + |where: => refers to a fresh root capability created in anonymous function of type (io1: IO^): Unit when checking argument to parameter op of method withIO + | ^ refers to the universal root capability + | cap is a fresh root capability created in anonymous function of type (io3: IO^'s1): Unit of parameter parameter io3² of method $anonfun + | cap² is a fresh root capability in the type of variable myIO 13 | myIO = io3 | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/lazylist.check b/tests/neg-custom-args/captures/lazylist.check index f2fbef088d18..7dc69e879466 100644 --- a/tests/neg-custom-args/captures/lazylist.check +++ b/tests/neg-custom-args/captures/lazylist.check @@ -3,6 +3,7 @@ | ^^^^ | Found: lazylists.LazyList[T]^{LazyCons.this.xs} | Required: lazylists.LazyList[T] + | | Note that capability LazyCons.this.xs is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^^^^ | Found: (ref1 : lazylists.LazyCons[Int]{val xs: () ->{cap1} lazylists.LazyList[Int]^{}}^{cap1}) | Required: lazylists.LazyList[Int] + | | Note that capability cap1 is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -19,6 +21,7 @@ | ^^^^ | Found: (ref2 : lazylists.LazyList[Int]^{cap2, ref1}) | Required: lazylists.LazyList[Int]^{ref1} + | | Note that capability cap2 is not included in capture set {ref1}. | | longer explanation available when compiling with `-explain` @@ -27,6 +30,7 @@ | ^^^^ | Found: (ref3 : lazylists.LazyList[Int]^{cap2, ref1}) | Required: lazylists.LazyList[Int]^{cap2} + | | Note that capability ref1 is not included in capture set {cap2}. | | longer explanation available when compiling with `-explain` @@ -35,6 +39,7 @@ | ^^^^ | Found: (ref4 : lazylists.LazyList[Int]^{cap3, cap1, cap2}) | Required: lazylists.LazyList[Int]^{cap1, ref3} + | | Note that capability cap3 is not included in capture set {cap1, ref3}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/lazylists1.check b/tests/neg-custom-args/captures/lazylists1.check index a642351ddea9..717c2f4f57ab 100644 --- a/tests/neg-custom-args/captures/lazylists1.check +++ b/tests/neg-custom-args/captures/lazylists1.check @@ -3,6 +3,7 @@ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | Found: LazyList[A]^{xs, f} | Required: LazyList[A]^{Mapped.this, f} + | | Note that capability xs is not included in capture set {Mapped.this, f}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/lazylists2.check b/tests/neg-custom-args/captures/lazylists2.check index bd90de396a22..027853498cf3 100644 --- a/tests/neg-custom-args/captures/lazylists2.check +++ b/tests/neg-custom-args/captures/lazylists2.check @@ -3,6 +3,7 @@ | ^ | Found: LazyList[B^'s1]^{f, xs} | Required: LazyList[B]^{f} + | | Note that capability xs is not included in capture set {f}. 19 | this: (Mapped^{xs, f}) => 20 | def isEmpty = false @@ -16,6 +17,7 @@ | ^ | Found: LazyList[B^'s2]^{f, xs} | Required: LazyList[B]^{xs} + | | Note that capability f is not included in capture set {xs}. 28 | this: Mapped^{xs, f} => 29 | def isEmpty = false @@ -37,6 +39,7 @@ | ^ | Found: LazyList[B^'s3]^{f, xs} | Required: LazyList[B]^{xs} + | | Note that capability f is not included in capture set {xs}. 46 | this: (Mapped^{xs, f}) => 47 | def isEmpty = false diff --git a/tests/neg-custom-args/captures/lazyref.check b/tests/neg-custom-args/captures/lazyref.check index 596e688faf0b..8a22613551c2 100644 --- a/tests/neg-custom-args/captures/lazyref.check +++ b/tests/neg-custom-args/captures/lazyref.check @@ -3,6 +3,7 @@ | ^^^^ | Found: (ref1 : LazyRef[Int]{val elem: () ->{cap1} Int}^{cap1}) | Required: LazyRef[Int] + | | Note that capability cap1 is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^^^^ | Found: LazyRef[Int]{val elem: () ->{ref2*} Int}^{ref2} | Required: LazyRef[Int]^{cap2} + | | Note that capability ref2 is not included in capture set {cap2}. | | longer explanation available when compiling with `-explain` @@ -19,6 +21,7 @@ | ^^^^ | Found: LazyRef[Int]{val elem: () ->{ref3*} Int}^{ref3} | Required: LazyRef[Int]^{ref1} + | | Note that capability ref3 is not included in capture set {ref1}. | | longer explanation available when compiling with `-explain` @@ -27,6 +30,7 @@ | ^^^^ | Found: LazyRef[Int]{val elem: () ->{ref4*} Int}^{ref4} | Required: LazyRef[Int]^{cap1} + | | Note that capability ref4 is not included in capture set {cap1}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/leak-problem-2.check b/tests/neg-custom-args/captures/leak-problem-2.check index 71af3da33844..ddbcb8839fa8 100644 --- a/tests/neg-custom-args/captures/leak-problem-2.check +++ b/tests/neg-custom-args/captures/leak-problem-2.check @@ -3,6 +3,7 @@ | ^^^^^^^^^^^^^^^^^^^^^ | Found: Source[T^'s1]^{src1, src2} | Required: Source[T] + | | Note that capability src1 is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/leaking-iterators.check b/tests/neg-custom-args/captures/leaking-iterators.check index 51bef2ed5e0f..b3b8e36fef79 100644 --- a/tests/neg-custom-args/captures/leaking-iterators.check +++ b/tests/neg-custom-args/captures/leaking-iterators.check @@ -4,10 +4,10 @@ |Found: (log: java.io.FileOutputStream^'s1) ->'s2 cctest.Iterator[Int]^{log} |Required: java.io.FileOutputStream^ => cctest.Iterator[Int]^'s3 | + |Note that capability log cannot be included in outer capture set 's3. + | |where: => refers to a fresh root capability created in method test when checking argument to parameter op of method usingLogFile | ^ refers to the universal root capability - | - |Note that capability log cannot be included in outer capture set 's3. 57 | xs.iterator.map: x => 58 | log.write(x) 59 | x * x diff --git a/tests/neg-custom-args/captures/leaky.check b/tests/neg-custom-args/captures/leaky.check index 932ab1ebf7af..c441ac5f102e 100644 --- a/tests/neg-custom-args/captures/leaky.check +++ b/tests/neg-custom-args/captures/leaky.check @@ -3,6 +3,7 @@ | ^ | Found: test.runnable.Transform{val fun: Any ->{a} Any}^{a} | Required: test.runnable.Transform + | | Note that capability a is not included in capture set {}. 15 | a.print() 16 | () @@ -14,6 +15,7 @@ | ^ | Found: test.runnable.Transform{val fun: Any ->{a} Any}^{a} | Required: test.runnable.Transform + | | Note that capability a is not included in capture set {}. 21 | a.print() 22 | () @@ -26,6 +28,7 @@ | ^ | Found: test.runnable.Transform{val fun: Any ->{a} Any}^{a} | Required: test.runnable.Transform + | | Note that capability a is not included in capture set {}. 28 | a.print() 29 | () diff --git a/tests/neg-custom-args/captures/levels.check b/tests/neg-custom-args/captures/levels.check index 30bad568e021..a7650a8ad19f 100644 --- a/tests/neg-custom-args/captures/levels.check +++ b/tests/neg-custom-args/captures/levels.check @@ -10,6 +10,7 @@ | ^ | Found: (x: String) ->{cap3} String | Required: String -> String + | | Note that capability cap3 is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/lubs.check b/tests/neg-custom-args/captures/lubs.check index b290c442956a..eaed760ac8a8 100644 --- a/tests/neg-custom-args/captures/lubs.check +++ b/tests/neg-custom-args/captures/lubs.check @@ -3,6 +3,7 @@ | ^^ | Found: (x1 : D^{d1}) | Required: D + | | Note that capability d1 is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^^ | Found: (x2 : D^{d1}) | Required: D + | | Note that capability d1 is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -19,6 +21,7 @@ | ^^ | Found: (x3 : D^{d1, d2}) | Required: D + | | Note that capability d1 is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/nestedclass.check b/tests/neg-custom-args/captures/nestedclass.check index c50c06d908cd..89a94b89d8d9 100644 --- a/tests/neg-custom-args/captures/nestedclass.check +++ b/tests/neg-custom-args/captures/nestedclass.check @@ -3,6 +3,7 @@ | ^^ | Found: (xs : C^{cap1}) | Required: C + | | Note that capability cap1 is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/outer-var.check b/tests/neg-custom-args/captures/outer-var.check index 6d4e37022a26..36ce2f308d8c 100644 --- a/tests/neg-custom-args/captures/outer-var.check +++ b/tests/neg-custom-args/captures/outer-var.check @@ -4,11 +4,12 @@ | Found: (q : () => Unit) | Required: () ->{p, q²} Unit | - | where: => refers to a fresh root capability in the type of parameter q - | q is a parameter in method inner - | q² is a parameter in method test + | Note that capability cap is not included in capture set {p, q²}. | - | Note that capability cap is not included in capture set {p, q}. + | where: => refers to a fresh root capability in the type of parameter q + | cap is a fresh root capability in the type of parameter q + | q is a parameter in method inner + | q² is a parameter in method test | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:13:9 ------------------------------------- @@ -17,10 +18,11 @@ | Found: () => Unit | Required: () ->{p, q} Unit | - | where: => refers to a fresh root capability created in method inner - | | Note that capability cap is not included in capture set {p, q}. | + | where: => refers to a fresh root capability created in method inner + | cap is a fresh root capability created in method inner + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:14:9 ------------------------------------- 14 | y = (q: Proc) // error @@ -28,10 +30,11 @@ | Found: () => Unit | Required: () ->{p} Unit | - | where: => refers to a fresh root capability created in method inner - | | Note that capability cap cannot be included in capture set {p} of variable y. | + | where: => refers to a fresh root capability created in method inner + | cap is a fresh root capability created in method inner + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/outer-var.scala:15:8 ------------------------------------- 15 | y = q // error, was OK under unsealed @@ -39,10 +42,11 @@ | Found: (q : () => Unit) | Required: () ->{p} Unit | - | where: => refers to a fresh root capability in the type of parameter q - | | Note that capability cap cannot be included in capture set {p} of variable y. | + | where: => refers to a fresh root capability in the type of parameter q + | cap is a fresh root capability in the type of parameter q + | | longer explanation available when compiling with `-explain` -- Error: tests/neg-custom-args/captures/outer-var.scala:17:57 --------------------------------------------------------- 17 | var finalizeActions = collection.mutable.ListBuffer[() => Unit]() // error, was OK under unsealed diff --git a/tests/neg-custom-args/captures/reaches.check b/tests/neg-custom-args/captures/reaches.check index 25574538070a..bcfbc33c8a9f 100644 --- a/tests/neg-custom-args/captures/reaches.check +++ b/tests/neg-custom-args/captures/reaches.check @@ -4,10 +4,11 @@ |Found: (f: File^'s1) ->'s2 Unit |Required: File^ => Unit | - |where: => refers to a fresh root capability created in method runAll0 when checking argument to parameter f of method usingFile - | ^ refers to the universal root capability - | |Note that capability cap is not included in capture set {C}. + | + |where: => refers to a fresh root capability created in method runAll0 when checking argument to parameter f of method usingFile + | ^ refers to the universal root capability + | cap is a fresh root capability created in anonymous function of type (f: File^'s1): Unit of parameter parameter f² of method $anonfun 23 | cur = (() => f.write()) :: Nil | | longer explanation available when compiling with `-explain` @@ -17,10 +18,11 @@ |Found: (f: File^'s3) ->'s4 Unit |Required: File^ => Unit | - |where: => refers to a fresh root capability created in method runAll1 when checking argument to parameter f of method usingFile - | ^ refers to the universal root capability - | |Note that capability cap cannot be included in capture set {C} of value cur. + | + |where: => refers to a fresh root capability created in method runAll1 when checking argument to parameter f of method usingFile + | ^ refers to the universal root capability + | cap is a fresh root capability created in anonymous function of type (f: File^'s3): Unit of parameter parameter f² of method $anonfun 33 | cur.set: 34 | (() => f.write()) :: Nil | @@ -38,11 +40,13 @@ | Found: () => Unit | Required: () =>² Unit | - | where: => refers to the universal root capability - | =>² refers to a fresh root capability in the type of value next + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value next. | - | Note that capability cap is not included in capture set {cap} - | because cap is not visible from cap in value next. + | where: => refers to the universal root capability + | =>² refers to a fresh root capability in the type of value next + | cap is the universal root capability + | cap² is a fresh root capability in the type of value next | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/reaches.scala:48:20 -------------------------------------- @@ -51,11 +55,13 @@ | Found: List[() => Unit] | Required: List[() =>² Unit] | - | where: => refers to the universal root capability - | =>² refers to a fresh root capability created in method runAll3 + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in method runAll3. | - | Note that capability cap is not included in capture set {cap} - | because cap is not visible from cap in method runAll3. + | where: => refers to the universal root capability + | =>² refers to a fresh root capability created in method runAll3 + | cap is the universal root capability + | cap² is a fresh root capability created in method runAll3 | | longer explanation available when compiling with `-explain` -- Error: tests/neg-custom-args/captures/reaches.scala:54:51 ----------------------------------------------------------- @@ -68,15 +74,17 @@ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/reaches.scala:59:27 -------------------------------------- 59 | val id: File^ -> File^ = x => x // error | ^^^^^^ - | Found: (x: File^) ->'s5 File^² - | Required: File^ -> File^³ + | Found: (x: File^) ->'s5 File^² + | Required: File^ -> File^³ | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: File^): File^² - | ^³ refers to a fresh root capability in the type of value id + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value id. | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value id. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: File^): File^² + | ^³ refers to a fresh root capability in the type of value id + | cap is a root capability associated with the result type of (x: File^): File^² + | cap² is a fresh root capability in the type of value id | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/reaches.scala:69:38 -------------------------------------- @@ -85,10 +93,11 @@ |Found: (f: File^'s6) ->'s7 File^{id*} |Required: File^ => File^{id*} | - |where: => refers to a fresh root capability created in value leaked when checking argument to parameter f of method usingFile - | ^ refers to the universal root capability - | |Note that capability cap is not included in capture set {id*}. + | + |where: => refers to a fresh root capability created in value leaked when checking argument to parameter f of method usingFile + | ^ refers to the universal root capability + | cap is a fresh root capability created in anonymous function of type (f: File^'s6): File^{id*} of parameter parameter f² of method $anonfun 70 | val f1: File^{id*} = id(f) 71 | f1 | @@ -99,11 +108,11 @@ |Found: (x$1: (A^ ->'s8 A^'s9, A^ ->'s10 A^'s11)^'s12) ->'s13 A^'s14 ->'s15 A^'s16 |Required: ((A ->{ps*} A, A ->{ps*} A)) => A^'s17 ->'s18 A^'s19 | + |Note that capability ps* cannot be included in capture set {} of value x. + | |where: => refers to a fresh root capability created in method mapCompose when checking argument to parameter f of method map | ^ refers to the universal root capability | - |Note that capability ps* cannot be included in capture set {} of value x. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/reaches.scala:90:10 -------------------------------------- 90 | ps.map((x, y) => compose1(x, y)) // error @@ -111,11 +120,11 @@ |Found: (x$1: (A^ ->'s20 A^'s21, A^ ->'s22 A^'s23)^'s24) ->'s25 A^'s26 ->'s27 A^'s28 |Required: ((A ->{C} A, A ->{C} A)) => A^'s29 ->'s30 A^'s31 | + |Note that capability C cannot be included in capture set {} of value x. + | |where: => refers to a fresh root capability created in method mapCompose2 when checking argument to parameter f of method map | ^ refers to the universal root capability | - |Note that capability C cannot be included in capture set {} of value x. - | | longer explanation available when compiling with `-explain` -- Error: tests/neg-custom-args/captures/reaches.scala:39:31 ----------------------------------------------------------- 39 | val next: () => Unit = cur.head // error, use diff --git a/tests/neg-custom-args/captures/reaches2.check b/tests/neg-custom-args/captures/reaches2.check index 5ab7b14a85c1..6d8acec2f565 100644 --- a/tests/neg-custom-args/captures/reaches2.check +++ b/tests/neg-custom-args/captures/reaches2.check @@ -3,6 +3,7 @@ | ^^^^^^^^^^^^^^^^^^^^^^^ | Found: (x$1: (A^'s1 ->{ps*} A^'s2, A^'s3 ->{ps*} A^'s4)^'s5) ->{ps*} A^'s6 ->{ps*} A^'s7 | Required: ((A ->{ps*} A, A ->{ps*} A)) -> A^'s6 ->{ps*} A^'s7 + | | Note that capability ps* is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/readOnly.check b/tests/neg-custom-args/captures/readOnly.check index 31d9940ab87e..31c66ceabb07 100644 --- a/tests/neg-custom-args/captures/readOnly.check +++ b/tests/neg-custom-args/captures/readOnly.check @@ -3,6 +3,7 @@ | ^^^^ | Found: (getA : () ->{a.rd} Int) | Required: () -> Int + | | Note that capability a.rd is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^^^^ | Found: (putA : Int ->{a} Unit) | Required: Int -> Unit + | | Note that capability a is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/ro-mut-conformance.check b/tests/neg-custom-args/captures/ro-mut-conformance.check index 5fe6730551b4..9e8a2f3a5548 100644 --- a/tests/neg-custom-args/captures/ro-mut-conformance.check +++ b/tests/neg-custom-args/captures/ro-mut-conformance.check @@ -6,11 +6,15 @@ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/ro-mut-conformance.scala:12:21 --------------------------- 12 | val t: Ref^{cap} = a // error | ^ - | Found: (a : Ref) - | Required: Ref^ + | Found: (a : Ref) + | Required: Ref^ | - | where: ^ refers to a fresh root capability classified as Mutable in the type of value t + | Note that capability a is not included in capture set {}. | - | Note that capability a is not included in capture set {}. + | Note that {cap} is an exclusive capture set of the mutable type Ref^, + | it cannot subsume a read-only capture set of the mutable type (a : Ref).. + | + | where: ^ refers to a fresh root capability classified as Mutable in the type of value t + | cap is a fresh root capability classified as Mutable in the type of value t | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/scope-extrude-mut.check b/tests/neg-custom-args/captures/scope-extrude-mut.check index 64a17296b7d4..9835c004054d 100644 --- a/tests/neg-custom-args/captures/scope-extrude-mut.check +++ b/tests/neg-custom-args/captures/scope-extrude-mut.check @@ -4,10 +4,12 @@ |Found: (a1 : A^) |Required: A^² | - |where: ^ refers to a fresh root capability classified as Mutable created in value a1 when constructing mutable A - | ^² refers to a fresh root capability classified as Mutable in the type of variable a + |Note that capability cap is not included in capture set {cap²} + |because cap in method b is not visible from cap² in variable a. | - |Note that capability cap is not included in capture set {cap} - |because cap in method b is not visible from cap in variable a. + |where: ^ refers to a fresh root capability classified as Mutable created in value a1 when constructing mutable A + | ^² refers to a fresh root capability classified as Mutable in the type of variable a + | cap is a fresh root capability classified as Mutable created in value a1 when constructing mutable A + | cap² is a fresh root capability classified as Mutable in the type of variable a | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/scoped-caps.check b/tests/neg-custom-args/captures/scoped-caps.check index d1559c50f0fc..e9a421dfc044 100644 --- a/tests/neg-custom-args/captures/scoped-caps.check +++ b/tests/neg-custom-args/captures/scoped-caps.check @@ -4,12 +4,14 @@ | Found: (f : (x: A^) -> B^²) | Required: A^ -> B^³ | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: A^): B^² - | ^³ refers to a fresh root capability in the type of value g + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value g. | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value g. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: A^): B^² + | ^³ refers to a fresh root capability in the type of value g + | cap is a root capability associated with the result type of (x: A^): B^² + | cap² is a fresh root capability in the type of value g | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps.scala:9:25 ----------------------------------- @@ -18,10 +20,14 @@ | Found: A^ -> B^{g*} | Required: (x: A^) -> B^² | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: A^): B^² + | Note that capability g* is not included in capture set {cap}. | - | Note that capability g* is not included in capture set {}. + | Note that the existential capture root in B^ + | cannot subsume the capability g* since that capability is not a `Sharable` capability.. + | + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: A^): B^² + | cap is a root capability associated with the result type of (x: A^): B^² | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps.scala:10:20 ---------------------------------- @@ -30,12 +36,14 @@ | Found: (f : (x: A^) -> B^²) | Required: A^ -> B^³ | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: A^): B^² - | ^³ refers to a fresh root capability in the type of value _$3 + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value _$3. | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value _$3. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: A^): B^² + | ^³ refers to a fresh root capability in the type of value _$3 + | cap is a root capability associated with the result type of (x: A^): B^² + | cap² is a fresh root capability in the type of value _$3 | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps.scala:12:20 ---------------------------------- @@ -44,23 +52,27 @@ | Found: (x: A^) ->{g} B^² | Required: A^ -> B^³ | + | Note that capability g is not included in capture set {}. + | | where: ^ refers to the universal root capability | ^² refers to a root capability associated with the result type of (x: A^): B^² | ^³ refers to a fresh root capability in the type of value _$5 | - | Note that capability g is not included in capture set {}. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps.scala:16:24 ---------------------------------- 16 | val _: (x: S) -> B^ = h // error: direct conversion fails | ^ - | Found: S^ -> B^{h*} - | Required: (x: S^) -> B^² + | Found: S^ -> B^{h*} + | Required: (x: S^) -> B^² | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: S^): B^² + | Note that capability h* is not included in capture set {cap}. | - | Note that capability h* is not included in capture set {}. + | Note that the existential capture root in B^ + | cannot subsume the capability h* since that capability is not a `Sharable` capability.. + | + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: S^): B^² + | cap is a root capability associated with the result type of (x: S^): B^² | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps.scala:17:24 ---------------------------------- @@ -69,12 +81,12 @@ | Found: (x: S^) ->{h} B^² | Required: (x: S^) -> B^³ | + | Note that capability h is not included in capture set {}. + | | where: ^ refers to the universal root capability | ^² refers to a root capability associated with the result type of (x: S^): B^² | ^³ refers to a root capability associated with the result type of (x: S^): B^³ | - | Note that capability h is not included in capture set {}. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps.scala:21:23 ---------------------------------- 21 | val _: (x: S) -> S = (x: S) => h2(x) // error: eta conversion fails since `h2` is now impure (result type S is a capability) @@ -82,12 +94,12 @@ | Found: (x: S^) ->{h2} S^² | Required: (x: S^) -> S^³ | + | Note that capability h2 is not included in capture set {}. + | | where: ^ refers to the universal root capability | ^² refers to a root capability associated with the result type of (x: S^): S^² | ^³ refers to a root capability associated with the result type of (x: S^): S^³ | - | Note that capability h2 is not included in capture set {}. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps.scala:27:19 ---------------------------------- 27 | val _: S -> B^ = j // error @@ -95,12 +107,14 @@ | Found: (j : (x: S) -> B^) | Required: S^² -> B^³ | - | where: ^ refers to a root capability associated with the result type of (x: S^²): B^ - | ^² refers to the universal root capability - | ^³ refers to a fresh root capability in the type of value _$14 + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value _$14. | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value _$14. + | where: ^ refers to a root capability associated with the result type of (x: S^²): B^ + | ^² refers to the universal root capability + | ^³ refers to a fresh root capability in the type of value _$14 + | cap is a root capability associated with the result type of (x: S^²): B^ + | cap² is a fresh root capability in the type of value _$14 | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/scoped-caps.scala:28:19 ---------------------------------- @@ -109,11 +123,13 @@ | Found: (x: S^) ->'s1 B^² | Required: S^ -> B^³ | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: S^): B^² - | ^³ refers to a fresh root capability in the type of value _$15 + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value _$15. | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value _$15. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: S^): B^² + | ^³ refers to a fresh root capability in the type of value _$15 + | cap is a root capability associated with the result type of (x: S^): B^² + | cap² is a fresh root capability in the type of value _$15 | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/sep-curried.check b/tests/neg-custom-args/captures/sep-curried.check index 47a3aecd9511..ea892881a3b6 100644 --- a/tests/neg-custom-args/captures/sep-curried.check +++ b/tests/neg-custom-args/captures/sep-curried.check @@ -4,10 +4,11 @@ | Found: (y: Ref[Int]^) ->{a} Unit | Required: (y: Ref[Int]^{a}) ->{a} Unit | - | where: ^ refers to the universal root capability - | | Note that capability a is not included in capture set {cap}. | + | where: ^ refers to the universal root capability + | cap is the universal root capability + | | longer explanation available when compiling with `-explain` -- Error: tests/neg-custom-args/captures/sep-curried.scala:16:6 -------------------------------------------------------- 16 | foo(a)(a) // error diff --git a/tests/neg-custom-args/captures/simple-using.check b/tests/neg-custom-args/captures/simple-using.check index dbe4ee74ff52..3c3ca24ebb47 100644 --- a/tests/neg-custom-args/captures/simple-using.check +++ b/tests/neg-custom-args/captures/simple-using.check @@ -4,9 +4,9 @@ |Found: (f: java.io.FileOutputStream^'s1) ->'s2 () ->{f} Unit |Required: java.io.FileOutputStream^ => () ->'s3 Unit | + |Note that capability f cannot be included in outer capture set 's3. + | |where: => refers to a fresh root capability created in method test when checking argument to parameter op of method usingLogFile | ^ refers to the universal root capability | - |Note that capability f cannot be included in outer capture set 's3. - | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/try.check b/tests/neg-custom-args/captures/try.check index ea67bcd4b414..7a42adb8bbdc 100644 --- a/tests/neg-custom-args/captures/try.check +++ b/tests/neg-custom-args/captures/try.check @@ -11,12 +11,13 @@ |Found: (x: CT[Exception]^) ->'s1 CT[Exception]^{x} |Required: CT[Exception]^ => CT[Exception]^² | - |where: => refers to a fresh root capability created in value a when checking argument to parameter op of method handle - | ^ refers to the universal root capability - | ^² refers to a fresh root capability created in value a when checking argument to parameter op of method handle - | |Note that capability x is not included in capture set {cap} |because (x : CT[Exception]^) is not visible from cap in value a. + | + |where: => refers to a fresh root capability created in value a when checking argument to parameter op of method handle + | ^ refers to the universal root capability + | ^² refers to a fresh root capability created in value a when checking argument to parameter op of method handle + | cap is a fresh root capability created in value a when checking argument to parameter op of method handle 24 | (x: CanThrow[Exception]) => x 25 | }{ | @@ -27,10 +28,10 @@ |Found: (x: CT[Exception]^) ->'s2 () ->{x} Nothing |Required: CT[Exception]^ => () -> Nothing | + |Note that capability x is not included in capture set {}. + | |where: => refers to a fresh root capability created in value b when checking argument to parameter op of method handle | ^ refers to the universal root capability - | - |Note that capability x is not included in capture set {}. 30 | (x: CanThrow[Exception]) => () => raise(new Exception)(using x) 31 | } { | @@ -41,10 +42,10 @@ |Found: (x: CT[Exception]^) ->'s3 () ->{x} Int |Required: CT[Exception]^ => () ->'s4 Int | + |Note that capability x cannot be included in outer capture set 's4. + | |where: => refers to a fresh root capability created in value xx when checking argument to parameter op of method handle | ^ refers to the universal root capability - | - |Note that capability x cannot be included in outer capture set 's4. 36 | (x: CanThrow[Exception]) => 37 | () => 38 | raise(new Exception)(using x) @@ -58,10 +59,10 @@ |Found: (x: CT[Exception]^) ->'s5 () ->{x} Int |Required: CT[Exception]^ => () ->'s6 Int | + |Note that capability x cannot be included in outer capture set 's6. + | |where: => refers to a fresh root capability created in value global when checking argument to parameter op of method handle | ^ refers to the universal root capability - | - |Note that capability x cannot be included in outer capture set 's6. 48 | (x: CanThrow[Exception]) => 49 | () => 50 | raise(new Exception)(using x) diff --git a/tests/neg-custom-args/captures/unsound-reach-4.check b/tests/neg-custom-args/captures/unsound-reach-4.check index 2baeaa5b9ad6..56e1a0cc1548 100644 --- a/tests/neg-custom-args/captures/unsound-reach-4.check +++ b/tests/neg-custom-args/captures/unsound-reach-4.check @@ -11,10 +11,12 @@ | Found: Bar^'s1 | Required: Foo[File^] | - | where: ^ refers to a fresh root capability in the type of value backdoor + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value backdoor. | - | Note that capability cap is not included in capture set {cap} - | because cap is not visible from cap in value backdoor. + | where: ^ refers to a fresh root capability in the type of value backdoor + | cap is the universal root capability + | cap² is a fresh root capability in the type of value backdoor | | longer explanation available when compiling with `-explain` -- [E164] Declaration Error: tests/neg-custom-args/captures/unsound-reach-4.scala:17:6 --------------------------------- diff --git a/tests/neg-custom-args/captures/unsound-reach-6.check b/tests/neg-custom-args/captures/unsound-reach-6.check index 9a21ef84cb97..c6f45c15e62b 100644 --- a/tests/neg-custom-args/captures/unsound-reach-6.check +++ b/tests/neg-custom-args/captures/unsound-reach-6.check @@ -3,6 +3,7 @@ | ^ | Found: (x : () ->{ys*} Unit) | Required: () -> Unit + | | Note that capability ys* is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^ | Found: (x : () ->{io} Unit) | Required: () -> Unit + | | Note that capability io is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/unsound-reach.check b/tests/neg-custom-args/captures/unsound-reach.check index 512d1088fa27..7f713586b6ec 100644 --- a/tests/neg-custom-args/captures/unsound-reach.check +++ b/tests/neg-custom-args/captures/unsound-reach.check @@ -18,9 +18,11 @@ | Found: Bar^'s1 | Required: Foo[File^] | - | where: ^ refers to a fresh root capability in the type of value backdoor + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value backdoor. | - | Note that capability cap is not included in capture set {cap} - | because cap is not visible from cap in value backdoor. + | where: ^ refers to a fresh root capability in the type of value backdoor + | cap is the universal root capability + | cap² is a fresh root capability in the type of value backdoor | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/use-capset.check b/tests/neg-custom-args/captures/use-capset.check index a00d77fc560f..d228a87229d7 100644 --- a/tests/neg-custom-args/captures/use-capset.check +++ b/tests/neg-custom-args/captures/use-capset.check @@ -3,6 +3,7 @@ | ^ | Found: (h : () ->{io} Unit) | Required: () -> Unit + | | Note that capability io is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^^ | Found: (h2 : () ->{} List[Object^{io}]^{} ->{io} Object^{io}) | Required: () -> List[Object^{io}] -> Object^{io} + | | Note that capability io is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/uses.check b/tests/neg-custom-args/captures/uses.check index 43d0ff8cec6d..08c79dd8fb5f 100644 --- a/tests/neg-custom-args/captures/uses.check +++ b/tests/neg-custom-args/captures/uses.check @@ -3,6 +3,7 @@ | ^ | Found: (d : D^{x, y}) | Required: D^{y} + | | Note that capability x is not included in capture set {y}. | | longer explanation available when compiling with `-explain` @@ -11,6 +12,7 @@ | ^ | Found: (d : D^{x, y}) | Required: D + | | Note that capability x is not included in capture set {}. | | longer explanation available when compiling with `-explain` @@ -19,6 +21,7 @@ | ^ | Found: () ->{x, y} () ->{y} Unit | Required: () ->{x} () ->{y} Unit + | | Note that capability y is not included in capture set {x}. | | longer explanation available when compiling with `-explain` @@ -27,6 +30,7 @@ | ^ | Found: () ->{x, y} () ->{y} Unit | Required: () -> () -> Unit + | | Note that capability x is not included in capture set {}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/usingLogFile.check b/tests/neg-custom-args/captures/usingLogFile.check index e4a8ae2e42f3..82f0857c061b 100644 --- a/tests/neg-custom-args/captures/usingLogFile.check +++ b/tests/neg-custom-args/captures/usingLogFile.check @@ -4,11 +4,11 @@ |Found: (f: java.io.FileOutputStream^'s1) ->'s2 () ->{f} Unit |Required: java.io.FileOutputStream^ => () ->'s3 Unit | + |Note that capability f cannot be included in outer capture set 's3. + | |where: => refers to a fresh root capability created in value later when checking argument to parameter op of method usingLogFile | ^ refers to the universal root capability | - |Note that capability f cannot be included in outer capture set 's3. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/usingLogFile.scala:27:36 --------------------------------- 27 | private val later2 = usingLogFile { f => Cell(() => f.write(0)) } // error @@ -16,11 +16,11 @@ |Found: (f: java.io.FileOutputStream^'s4) ->'s5 Test2.Cell[() ->{f} Unit]^'s6 |Required: java.io.FileOutputStream^ => Test2.Cell[() ->'s7 Unit]^'s8 | + |Note that capability f cannot be included in outer capture set 's7. + | |where: => refers to a fresh root capability created in value later2 when checking argument to parameter op of method usingLogFile | ^ refers to the universal root capability | - |Note that capability f cannot be included in outer capture set 's7. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/usingLogFile.scala:43:33 --------------------------------- 43 | val later = usingFile("out", f => (y: Int) => xs.foreach(x => f.write(x + y))) // error @@ -28,11 +28,11 @@ |Found: (f: java.io.OutputStream^'s9) ->'s10 Int ->{f} Unit |Required: java.io.OutputStream^ => Int ->'s11 Unit | + |Note that capability f cannot be included in outer capture set 's11. + | |where: => refers to a fresh root capability created in value later when checking argument to parameter op of method usingFile | ^ refers to the universal root capability | - |Note that capability f cannot be included in outer capture set 's11. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/usingLogFile.scala:52:6 ---------------------------------- 52 | usingLogger(_, l => () => l.log("test"))) // error after checking mapping scheme @@ -40,9 +40,9 @@ |Found: (_$1: java.io.OutputStream^'s12) ->'s13 () ->{_$1} Unit |Required: java.io.OutputStream^ => () ->'s14 Unit | + |Note that capability _$1 cannot be included in outer capture set 's14. + | |where: => refers to a fresh root capability created in value later when checking argument to parameter op of method usingFile | ^ refers to the universal root capability | - |Note that capability _$1 cannot be included in outer capture set 's14. - | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/vars-simple.check b/tests/neg-custom-args/captures/vars-simple.check index 2fd7ead20da3..b4b4cac8fb99 100644 --- a/tests/neg-custom-args/captures/vars-simple.check +++ b/tests/neg-custom-args/captures/vars-simple.check @@ -4,16 +4,18 @@ | Found: String => String | Required: String ->{cap1, cap2} String | - | where: => refers to a fresh root capability created in method scope - | | Note that capability cap is not included in capture set {cap1, cap2}. | + | where: => refers to a fresh root capability created in method scope + | cap is a fresh root capability created in method scope + | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/vars-simple.scala:16:8 ----------------------------------- 16 | a = g // error | ^ | Found: (x: String) ->{cap3} String | Required: String ->{cap1, cap2} String + | | Note that capability cap3 is not included in capture set {cap1, cap2}. | | longer explanation available when compiling with `-explain` @@ -22,6 +24,7 @@ | ^^^^^^^ | Found: List[String ->{cap3} String] | Required: List[String ->{cap1, cap2} String] + | | Note that capability cap3 is not included in capture set {cap1, cap2}. | | longer explanation available when compiling with `-explain` diff --git a/tests/neg-custom-args/captures/vars.check b/tests/neg-custom-args/captures/vars.check index 052fd6bec10f..52b1e5559322 100644 --- a/tests/neg-custom-args/captures/vars.check +++ b/tests/neg-custom-args/captures/vars.check @@ -3,6 +3,7 @@ | ^^^^^^^^^ | Found: (x: String) ->{cap3} String | Required: String ->{cap1} String + | | Note that capability cap3, defined in method scope | cannot be included in outer capture set {cap1} of variable a. | @@ -12,6 +13,7 @@ | ^ | Found: (x: String) ->{cap3} String | Required: String ->{cap1} String + | | Note that capability cap3, defined in method scope | cannot be included in outer capture set {cap1} of variable a. | @@ -21,6 +23,7 @@ | ^^^^^^^ | Found: List[String ->{cap3} String] | Required: List[String ->{cap1, cap2} String] + | | Note that capability cap3 is not included in capture set {cap1, cap2}. | | longer explanation available when compiling with `-explain` @@ -30,11 +33,13 @@ |Found: (cap3: CC^) ->'s1 String => String |Required: CC^ -> String =>² String | - |where: => refers to a root capability associated with the result type of (cap3: CC^): String => String - | =>² refers to a fresh root capability created in method test of parameter parameter cap3² of method $anonfun - | ^ refers to the universal root capability + |Note that capability cap cannot be included in outer capture set {cap²}. | - |Note that capability String> cannot be included in outer capture set {cap}. + |where: => refers to a root capability associated with the result type of (cap3: CC^): String => String + | =>² refers to a fresh root capability created in method test of parameter parameter cap3² of method $anonfun + | ^ refers to the universal root capability + | cap is a root capability associated with the result type of (cap3: CC^): String =>² String + | cap² is a fresh root capability created in method test of parameter parameter cap3² of method $anonfun 37 | def g(x: String): String = if cap3 == cap3 then "" else "a" 38 | g 39 | } diff --git a/tests/neg-custom-args/captures/widen-reach.check b/tests/neg-custom-args/captures/widen-reach.check index e1f76704a3d2..23f18c88c9f9 100644 --- a/tests/neg-custom-args/captures/widen-reach.check +++ b/tests/neg-custom-args/captures/widen-reach.check @@ -8,15 +8,17 @@ -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/widen-reach.scala:9:24 ----------------------------------- 9 | val foo: IO^ -> IO^ = x => x // error | ^^^^^^ - | Found: (x: IO^) ->'s1 IO^² - | Required: IO^ -> IO^³ + | Found: (x: IO^) ->'s1 IO^² + | Required: IO^ -> IO^³ | - | where: ^ refers to the universal root capability - | ^² refers to a root capability associated with the result type of (x: IO^): IO^² - | ^³ refers to a fresh root capability in the type of value foo + | Note that capability cap is not included in capture set {cap²} + | because cap is not visible from cap² in value foo. | - | Note that capability is not included in capture set {cap} - | because is not visible from cap in value foo. + | where: ^ refers to the universal root capability + | ^² refers to a root capability associated with the result type of (x: IO^): IO^² + | ^³ refers to a fresh root capability in the type of value foo + | cap is a root capability associated with the result type of (x: IO^): IO^² + | cap² is a fresh root capability in the type of value foo | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/widen-reach.scala:13:26 ---------------------------------- @@ -25,11 +27,11 @@ | Found: IO^ ->{x*} IO^{x*} | Required: IO^ -> IO^² | + | Note that capability x* is not included in capture set {}. + | | where: ^ refers to the universal root capability | ^² refers to a fresh root capability in the type of value y2 | - | Note that capability x* is not included in capture set {}. - | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg-custom-args/captures/widen-reach.scala:14:30 ---------------------------------- 14 | val y3: IO^ -> IO^{x*} = y1.foo // error @@ -37,8 +39,8 @@ | Found: IO^ ->{x*} IO^{x*} | Required: IO^ -> IO^{x*} | - | where: ^ refers to the universal root capability - | | Note that capability x* is not included in capture set {}. | + | where: ^ refers to the universal root capability + | | longer explanation available when compiling with `-explain` diff --git a/tests/neg/i13780-1.check b/tests/neg/i13780-1.check index 07cc03b35dce..faf07be1b361 100644 --- a/tests/neg/i13780-1.check +++ b/tests/neg/i13780-1.check @@ -3,6 +3,8 @@ | ^^^^^^ | Found: Tuple.Head[VS & h *: t] | Required: h + | Note that implicit conversions were not tried because the result of an implicit conversion + | must be more specific than h | | where: VS is a type in method foo with bounds <: Tuple | h is a type in method foo @@ -17,8 +19,6 @@ | case x *: _ => x | The computed bounds for the parameter are: | x <: h - | Note that implicit conversions were not tried because the result of an implicit conversion - | must be more specific than h | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg/i13780-1.scala:52:31 ---------------------------------------------------------- diff --git a/tests/neg/i15998.check b/tests/neg/i15998.check index 1f25946624cf..587a8ca100f0 100644 --- a/tests/neg/i15998.check +++ b/tests/neg/i15998.check @@ -3,12 +3,20 @@ | ^ | Found: (1 : Int) | Required: CC[A] + | Note that implicit conversions were not tried because the result of an implicit conversion + | must be more specific than CC[A] | | where: A is a type variable | CC is a type variable with constraint <: [B] =>> Any | - | Note that implicit conversions were not tried because the result of an implicit conversion - | must be more specific than CC[A] + | + | One of the following imports might fix the problem: + | + | import scala.math.BigDecimal.int2bigDecimal + | import scala.math.BigInt.int2bigInt + | import scala.math.Ordered.orderingToOrdered + | import scala.util.chaining.scalaUtilChainingOps + | | | longer explanation available when compiling with `-explain` -- [E172] Type Error: tests/neg/i15998.scala:11:11 --------------------------------------------------------------------- diff --git a/tests/neg/i9568.check b/tests/neg/i9568.check index 744023714a69..c9d1f13abe95 100644 --- a/tests/neg/i9568.check +++ b/tests/neg/i9568.check @@ -4,10 +4,9 @@ | No given instance of type => Monad[F] was found for parameter ev of method blaMonad in object Test. | I found: | - | Test.blaMonad[F², S] + | Test.blaMonad[F, S] | | But method blaMonad in object Test does not match type => Monad[F] | - | where: F is a type variable with constraint <: [_] =>> Any - | F² is a type variable with constraint <: [_] =>> Any + | where: F is a type variable with constraint <: [_] =>> Any | . diff --git a/tests/neg/polymorphic-erased-functions-types.check b/tests/neg/polymorphic-erased-functions-types.check index f46940d61fa2..78a0ab37b1ab 100644 --- a/tests/neg/polymorphic-erased-functions-types.check +++ b/tests/neg/polymorphic-erased-functions-types.check @@ -9,10 +9,7 @@ 4 |def t1b: [T] => (erased t: T) => Unit = [T] => (t: T) => () // error | ^^^^^^^^^^^^^^^^^^^ | Found: [T] => (t: T) => Unit - | Required: [T] => (erased t²: T) => Unit - | - | where: t is a reference to a value parameter - | t² is a reference to a value parameter + | Required: [T] => (erased t: T) => Unit | | longer explanation available when compiling with `-explain` -- [E007] Type Mismatch Error: tests/neg/polymorphic-erased-functions-types.scala:6:36 --------------------------------- @@ -26,11 +23,6 @@ 7 |def t2b: [T, U] => (t: T, erased u: U) => Unit = [T, U] => (t: T, u: U) => () // error | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | Found: [T, U] => (t: T, u: U) => Unit - | Required: [T, U] => (t²: T, erased u²: U) => Unit - | - | where: t is a reference to a value parameter - | t² is a reference to a value parameter - | u is a reference to a value parameter - | u² is a reference to a value parameter + | Required: [T, U] => (t: T, erased u: U) => Unit | | longer explanation available when compiling with `-explain` diff --git a/tests/neg/polymorphic-functions1.check b/tests/neg/polymorphic-functions1.check index 612c1d0688a1..17c1fecb4dce 100644 --- a/tests/neg/polymorphic-functions1.check +++ b/tests/neg/polymorphic-functions1.check @@ -2,9 +2,6 @@ 1 |val f: [T] => (x: T) => x.type = [T] => (x: Int) => x // error | ^^^^^^^^^^^^^^^^^^^^ | Found: [T] => (x: Int) => (x : Int) - | Required: [T] => (x²: T) => (x² : T) - | - | where: x is a reference to a value parameter - | x² is a reference to a value parameter + | Required: [T] => (x: T) => (x : T) | | longer explanation available when compiling with `-explain`