Skip to content

Conversion to smth that extends Selectable doesn't work for dynamic syntax #24108

@road21

Description

@road21

Compiler version

3.7.2

Minimized code

//> using scala 3.7.2
object Foo

object Wrap extends Selectable:
  type Fields = (foo: Int)
  def selectDynamic(name: String): Any = 42

given Conversion[Foo.type, Wrap.type]:
  def apply(v: Foo.type): Wrap.type = Wrap

import scala.language.implicitConversions
println(Foo.foo) // compiler error value foo is not a member of object Foo

Output

compiler error value foo is not a member of object Foo

Expectation

No compiler error.

Notes

The problem is that type Selectable { type Fields = (foo: Int) } is not a subtype of refinement ?{ foo: <?> }.
So, when given conversion is checking as a candidate, method ProtoTypes.Compatibility#isCompatible returns false.

What about to make Selectable { type Fields = (foo: Int) } subtype of ?{ foo: <?> } ?

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