Skip to content

Transparent inline method call doesn't expand inside another inline method #12754

Closed
@Iltotore

Description

@Iltotore

Compiler version

3.0.0

Minimized code

First sample
transparent inline def transform(inline a: Any): Any = inline a match {
  case x: Byte   => x
  case x: Short  => x
  case x: Int    => x
  case x: Long   => x
  case x: Float  => x
  case x: Double => x
  case _         => a
}

@main def test = {
  println(transform(0) < 5)
}
Second sample
transparent inline def transform(inline a: Any): Any = inline a match {
  case x: Byte   => x
  case x: Short  => x
  case x: Int    => x
  case x: Long   => x
  case x: Float  => x
  case x: Double => x
  case _         => a
}

inline def lt(inline a: Any, inline b: Double): Boolean = transform(a) < b

@main def test = {
  println(lt(0, 5))
}

Expectation

The first sample compiles as expected.

The second sample doesn't compile but should. In lt, the transform call is fully inlined so I assume the compiler should be able to find the right return type.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions