Skip to content

inline match breaks simple example, documentation? #13774

Closed
@Adam-Vandervorst

Description

@Adam-Vandervorst

Compiler version

3.0.2

Minimized code

(transparent) inline def f(x: Int) = inline x match
  case 1 => 1
  case _ => 0

@main def m =
  val v = 1
  println(f(v))

Output

0

Expectation

Give the same output as (namely 1)

inline def f(x: Int) = x match
  case 1 => 1
  case _ => 0

and if not, be documented in the "Inline Matches" section of https://docs.scala-lang.org/scala3/reference/metaprogramming/inline.html.

(Note that this does work when v has singleton type 1)

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