Skip to content

Commit fe0bdad

Browse files
committed
Put i13864 in the blacklist of best-effort test.
1 parent 7f92b53 commit fe0bdad

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

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

+9-7
Original file line numberDiff line numberDiff line change
@@ -2329,14 +2329,16 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
23292329
untpd.Block(makeCanThrow(capabilityProof), expr)
23302330

23312331
def typedTry(tree: untpd.Try, pt: Type)(using Context): Try = {
2332-
// We want to type check tree.expr first to comput NotNullInfo, but `addCanThrowCapabilities`
2333-
// uses the types of patterns in `tree.cases` to determine the capabilities.
2334-
// Hence, we create a copy of cases with empty body and type check that first, then type check
2335-
// the rest of the tree in order.
2336-
val casesEmptyBody1 = tree.cases.mapconserve(cpy.CaseDef(_)(body = EmptyTree))
2337-
val casesEmptyBody2 = typedCases(casesEmptyBody1, EmptyTree, defn.ThrowableType, WildcardType)
2338-
23392332
val expr2 :: cases2x = harmonic(harmonize, pt) {
2333+
// We want to type check tree.expr first to comput NotNullInfo, but `addCanThrowCapabilities`
2334+
// uses the types of patterns in `tree.cases` to determine the capabilities.
2335+
// Hence, we create a copy of cases with empty body and type check that first, then type check
2336+
// the rest of the tree in order.
2337+
// It may seem that invalid references can be created if the type of the pattern contains
2338+
// type binds, but this is not a valid `CanThrow` capability (checked by `addCanThrowCapabilities`),
2339+
// so it is not a problem.
2340+
val casesEmptyBody1 = tree.cases.mapconserve(cpy.CaseDef(_)(body = EmptyTree))
2341+
val casesEmptyBody2 = typedCases(casesEmptyBody1, EmptyTree, defn.ThrowableType, WildcardType)
23402342
val expr1 = typed(addCanThrowCapabilities(tree.expr, casesEmptyBody2), pt.dropIfProto)
23412343
val casesCtx = ctx.addNotNullInfo(expr1.notNullInfo.retractedInfo)
23422344
val cases1 = typedCases(tree.cases, EmptyTree, defn.ThrowableType, pt.dropIfProto)(using casesCtx)

compiler/test/dotc/neg-best-effort-pickling.blacklist

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ i13780-1.scala
1616
i20317a.scala
1717
i11226.scala
1818
i974.scala
19+
i13864.scala
1920

2021
# semantic db generation fails in the first compilation
2122
i1642.scala

0 commit comments

Comments
 (0)