Skip to content

Anonymous given name clash for tuples #6938

Closed
@milessabin

Description

@milessabin

I think this is only an issue for tuple types with arity > 1 ...

Given,

trait Foo[T]
object Foo {
  given [T] as Foo[Tuple1[T]] {}
  given [T, U] as Foo[(T, U)] {}
  given [T, U, V] as Foo[(T, U, V)] {}
}

The compiler will name the Tuple1 instance as Foo_Tuple1_given, but both the Tuple2 and Tuple3 instances are named Foo_Tuple_given which results in the above failing with,

-- Error: local/given-tuples.scala:6:8 -----------------------------------------
6 |  given [T, U, V] as Foo[(T, U, V)] {}
  |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |  Foo_Tuple_given is already defined as class Foo_Tuple_given
one error found

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