Skip to content

Commit

Permalink
Put i13864 in the blacklist of best-effort test.
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Sep 9, 2024
1 parent 7f92b53 commit fe0bdad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2329,14 +2329,16 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
untpd.Block(makeCanThrow(capabilityProof), expr)

def typedTry(tree: untpd.Try, pt: Type)(using Context): Try = {
// We want to type check tree.expr first to comput NotNullInfo, but `addCanThrowCapabilities`
// uses the types of patterns in `tree.cases` to determine the capabilities.
// Hence, we create a copy of cases with empty body and type check that first, then type check
// the rest of the tree in order.
val casesEmptyBody1 = tree.cases.mapconserve(cpy.CaseDef(_)(body = EmptyTree))
val casesEmptyBody2 = typedCases(casesEmptyBody1, EmptyTree, defn.ThrowableType, WildcardType)

val expr2 :: cases2x = harmonic(harmonize, pt) {
// We want to type check tree.expr first to comput NotNullInfo, but `addCanThrowCapabilities`
// uses the types of patterns in `tree.cases` to determine the capabilities.
// Hence, we create a copy of cases with empty body and type check that first, then type check
// the rest of the tree in order.
// It may seem that invalid references can be created if the type of the pattern contains
// type binds, but this is not a valid `CanThrow` capability (checked by `addCanThrowCapabilities`),
// so it is not a problem.
val casesEmptyBody1 = tree.cases.mapconserve(cpy.CaseDef(_)(body = EmptyTree))
val casesEmptyBody2 = typedCases(casesEmptyBody1, EmptyTree, defn.ThrowableType, WildcardType)
val expr1 = typed(addCanThrowCapabilities(tree.expr, casesEmptyBody2), pt.dropIfProto)
val casesCtx = ctx.addNotNullInfo(expr1.notNullInfo.retractedInfo)
val cases1 = typedCases(tree.cases, EmptyTree, defn.ThrowableType, pt.dropIfProto)(using casesCtx)
Expand Down
1 change: 1 addition & 0 deletions compiler/test/dotc/neg-best-effort-pickling.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ i13780-1.scala
i20317a.scala
i11226.scala
i974.scala
i13864.scala

# semantic db generation fails in the first compilation
i1642.scala
Expand Down

0 comments on commit fe0bdad

Please sign in to comment.