Skip to content

MatchTypeNoCases is no longer emitted #24753

@WojciechMazur

Description

@WojciechMazur

MatchTypeNoCases error defined at

class MatchTypeNoCases(casesText: String)(using Context) extends TypeMsg(MatchTypeNoCasesID):
def msg(using Context) = i"Match type reduction $casesText"
def explain(using Context) = ""

originally used in
case Nil =>
/* TODO warn ? then re-enable warn/12974.scala:26
val noCasesText = MatchTypeTrace.noMatchesText(scrut, cases)
report.warning(reporting.MatchTypeNoCases(noCasesText), pos = ???)
*/
MatchTypeTrace.noMatches(scrut, cases)
NoType
inFrozenConstraint(recur(cases))

is still commented out. It makes this error code effectively inactive.

The mentioned test is still commented out

def main(args: Array[String]) =
import Record._
val foo: Any = Rec.empty.fetch("foo") // TODO
// ^
// Match type reduction failed since selector EmptyTuple.type
// matches none of the cases
//
// case (("foo" : String), t) *: _ => t
// case _ *: t => example.RecMap.Record.Rec.HasKey[t, ("foo" : String)]
end main

Compiler version

3.7.4
3.8.1-nightly

Expectation

It's been almost 2 years since this error message was suppressed we should either restore the original mechanism or make the error formally inactive.

Maybe related discussion in #23822

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions