Closed as not planned
Description
Compiler version
3.5.2
Minimized code
import scala.language.dynamics
trait DynamicHello[E] extends Dynamic:
extension (ref: E)
def selectDynamic(
field: String
): Any
given DynamicHello[String] with
extension (ref: String)
override def selectDynamic(field: String) = s"Hello $field"
// Doesn't compile with error:
// value hello is not a member of String [15:6]
def badHello(str: String) =
str.hello
// compile, and prove `DynamicHello[String]` does give to `String`
def goodHello(str: String) =
str.selectDynamic("hello")
Output
[info] compiling 1 Scala source to xxx ...
[error] -- [E008] Not Found Error: Example.scala:15:6
[error] 18 | str.hello
[error] | ^^^^^^^^^
[error] | value hello is not a member of String
[error] one error found
May relate to #17106