Skip to content

Inline match widening constant types #13161

Closed
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.0.1

Minimized code

transparent inline def f: String =
  inline 10 match
    case _ =>
      inline Some["foo"]("foo") match
        case Some(x) => x

def test =
  inline val failMsg = f

Output

8 |  inline val failMsg = f
  |                       ^
  |                       inline value must have a literal constant type

Expectation

Should compile.

It looks like the type parameter of the Some.unapply is widened at some point. I would expect the inline match to be typed as:

inline Some.apply["foo"]("foo") match 
    case Some.unapply["foo"](x @ _) => x:"foo"

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions