Skip to content

Nil and LinearSeq cannot be compared #21392

Closed
@Bersier

Description

@Bersier

Compiler version

3.5.1-RC2

Minimized code

import scala.collection.LinearSeq

def foo[T](a: LinearSeq[T]) = a match
  case Nil => -1
  case head +: tail => head

Compiler options

 -language:strictEquality
 -Yexplicit-nulls

Compiler output

Values of types object Nil and LinearSeq[T] cannot be compared with == or !=.

Expectation

No compile-error

Note: the addition of CanEqual givens between Nil.type and LinearSeq does not help.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions