Skip to content

Match Type producing a List in all cases is not always recognized as List but as IterableOnce #11729

Closed
@daenenk

Description

@daenenk

Compiler version 3.0.0-RC1

Minimized code

type Return[X] = X match
    case List[t] => List[t]
    case Any => List[X]

object Return:
  def apply[A](a:A):Return[A] = a match 
    case a: List[t] => a
    case a: Any => List(a)

object Test:
  Return(1).map(x => x)

Output

WARNING: method map in class IterableOnceExtensionMethods is deprecated since 2.13.0: Use .iterator.map instead or consider requiring an Iterable

Expectation

This should work. the same way as

  List(1).map(x => x)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions