Skip to content

inline match on Tuple fails #12770

Open
Open
@antognini

Description

@antognini

Compiler version

3.0.0

Minimized code

consider following signature:
def toListOfString(tuple: Tuple): List[String]

to be invoked with
toListOfString(1,2,3)

def toListOfString(tuple: Tuple): List[String] =
  tuple match
    case EmptyTuple   => List()
    case head *: tail => List(head.toString) ++ toListOfString(tail)

// works   => List(1, 2, 3)
// inline def
inline def toListOfString(tuple: Tuple): List[String] =
  tuple match
    case EmptyTuple   => List()
    case head *: tail => List(head.toString) ++ toListOfString(tail)

// Maximal number of successive inlines (32) exceeded,
// Maybe this is caused by a recursive inline method?

// I understand this, the compiler is trying to endlessly nest the same piece of code and fails
// inline match
inline def toListOfString(tuple: Tuple): List[String] =
  inline tuple match
    case EmptyTuple   => List()
    case head *: tail => List(head.toString) ++ toListOfString(tail)

// cannot reduce inline match with
// scrutinee:  tuple$proxy1 : (tuple$proxy1 : (Int, Int, Int))
//   patterns :  case EmptyTuple
//   case *:.unapply[Any, Tuple](head @ _, tail @ _):Any *: Tuple
//   inline tuple match

Expectation

This as a request for clarification (tag it as a question), promote it as a bug in case something needs to be fixed.
Is my expectation justified, that the variant with inline match should compile, like the non-inline toListOfString does?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions