Skip to content

Commit efc05b2

Browse files
committed
Add tests that failed in CI before
Had to turn an assertion into a condition to make it pass
1 parent 7dd576c commit efc05b2

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ extension (tp: Type)
331331
def boxed(using Context): Type = tp.dealias match
332332
case tp @ CapturingType(parent, refs) if !tp.isBoxed && !refs.isAlwaysEmpty =>
333333
tp.annot match
334-
case ann: CaptureAnnotation =>
335-
assert(!parent.derivesFrom(defn.Caps_CapSet))
334+
case ann: CaptureAnnotation if !parent.derivesFrom(defn.Caps_CapSet) =>
336335
AnnotatedType(parent, ann.boxedAnnot)
337336
case ann => tp
338337
case tp: RealTypeBounds =>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import language.experimental.captureChecking
2+
import caps.cap
3+
4+
trait Ctx[T >: Nothing <: Any]() extends Object
5+
6+
def test: Unit =
7+
{
8+
val x: Any^{cap} = ???
9+
val y: Any^{cap} = ???
10+
object O {
11+
val z: Any^{cap} = ???
12+
}
13+
val baz3:
14+
Int -> [C >: caps.CapSet <: caps.CapSet^,
15+
D >: caps.CapSet <: caps.CapSet^{C^}, E >: caps.CapSet <:
16+
caps.CapSet^{C^, x}] => () -> [F >: caps.CapSet^{x, y} <:
17+
caps.CapSet^{C^, E^}] => (x: Int) -> (Ctx[F]) ?-> Int
18+
= (i: Int) => [
19+
C >: _root_.scala.caps.CapSet <: _root_.scala.caps.CapSet^{cap},
20+
D >: _root_.scala.caps.CapSet <: _root_.scala.caps.CapSet^{C^},
21+
E >: _root_.scala.caps.CapSet <: _root_.scala.caps.CapSet^{C^, x}] =>
22+
() => [
23+
F
24+
>: _root_.scala.caps.CapSet^{x, y} <:
25+
_root_.scala.caps.CapSet^{C^, E^}
26+
] => (x: Int) => (ev: Ctx[F]) ?=> 1
27+
()
28+
}

0 commit comments

Comments
 (0)