Skip to content

Members from refinements cannot be exported #18251

Open
@prolativ

Description

@prolativ

Compiler version

3.3.2-RC1-bin-20230718-da16f43-NIGHTLY and before

Minimized code

class Sel extends Selectable:
  def selectDynamic(name: String) = ???

val sel = (new Sel).asInstanceOf[Sel {def xxx: String}]
val a: String = sel.xxx
val b: String =
  import sel.xxx
  xxx
val c: String =
  object Tmp:
    export sel.xxx
  Tmp.xxx

Output

[error] SelectableExport.scala:11:16
[error] no eligible member xxx at sel
[error] sel.xxx cannot be exported because it is not accessible
[error]     export sel.xxx
[error]                ^^^
[error] /var/folders/rp/f9y80jvs54lcy26rxnt2y2kw0000gn/T/SelectableExport.scala:12:3
[error] value xxx is not a member of object Tmp
[error]   Tmp.xxx
[error]   ^^^^^^^

Expectation

The code snippet should compile. All of a, b and c should have the same runtime value (given that selectDynamic gets an actual implementation). Similarly this should work for methods in refinements that require an argument and desugar to a call to applyDynamic.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions