Skip to content

Implicit conversion to Dynamic should allow dynamic selection #23787

@lego-eden

Description

@lego-eden

Compiler version

Scala 3.8.0-RC1-bin-20250814-0cf7a18-NIGHTLY

Minimized code

//> using scala 3.nightly

import scala.language.implicitConversions
import scala.language.dynamics

given Conversion[Int, Int & Dynamic] = _.asInstanceOf

extension (i: Int & Dynamic)
  def selectDynamic(s: String): Unit = println(s)

@main def main =
  4.fooMember

Output

Fails to compile:

[error] value fooMember is not a member of Int
[error]   4.fooMember
[error]   ^^^^^^^^^^^

Expectation

It compiles and prints fooMember. The implicit conversion should be called and int should be converted into Int & Dynamic, which should make this work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions