Skip to content

@unchecked tuple destructuring is now ignored #25544

@WojciechMazur

Description

@WojciechMazur

Based on the OpenCB failures in:

Compiler version

Last good nightly: 3.8.4-RC1-bin-20260227-4e9c706-NIGHTLY
First bad nightly: 3.8.4-RC1-bin-20260228-f302695-NIGHTLY

Bisect points to: 26cf713 (unlikely

Nightly bisect range: 4e9c706...f302695

Minimized code

import scala.unchecked

sealed trait Tree
final class DefDef extends Tree

object Repro:
  val trees: List[Tree] = Nil

  val (allDefs: List[DefDef] @unchecked, allStepBlocks: List[Tree]) =
    trees.partition {
      case _: DefDef => true
      case _ => false
    }

Output

$ scala-cli compile test.scala -S 3.8.4-RC1-bin-20260228-f302695-NIGHTLY --server=false
-- [E007] Type Mismatch Error: test.scala:9:39
9 |  val (allDefs: List[DefDef] @unchecked, allStepBlocks: List[Tree]) =
  |                                       ^
  |                                     Found:    (Repro.$2$._1 : List[Tree])
  |                                     Required: List[DefDef] @unchecked
  |
  | longer explanation available when compiling with `-explain`
1 error found
Compilation failed

Expectation

This should compile successfully, at most with the same narrowing warning emitted by 3.8.3-RC2 and 3.8.4-RC1-bin-20260227-4e9c706-NIGHTLY.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions