Skip to content

ExtensionNullifiedByMember false positive with opaque type #22279

Closed
@som-snytt

Description

@som-snytt

Compiler version

3.6.2

Minimized code

import scala.io.Source

object Lengths:
  opaque type Length = Int
  extension (source: Source)
    def take(length: Length): IndexedSeq[Char] =
      source.take(length).to(IndexedSeq)
end Lengths

Output

7 |    def take(length: Length): IndexedSeq[Char] =
  |        ^
  |Extension method take will never be selected
  |because Source already has a member with the same name and compatible parameter types.

Expectation

This is the paradigmatic use case and must not warn.

Noticed at https://discord.com/channels/632150470000902164/632150470000902166/1323293799966834688

Related issue #21816

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions