Skip to content

Extensions are resolved even when the opaque type doesn't match #22320

Closed
@hamzaremmal

Description

@hamzaremmal

Compiler version

3.6.2

Minimized code

package a:
  opaque type System = Any
  opaque type SimulatedSystem <: System = System

  extension (system: System)
    def x: BigInt = ???
    def y: BigInt = ???
  end extension

  extension (system: SimulatedSystem)
    def z: BigInt = ???
  end extension

package b:
  import a.*
  def issue(system: System) =
    val x = system.x // ok
    val y = system.y // oK
    val z = system.z // ok...!!

Output

Compiles

Expectation

val z = system.z // ok...!!

This line shouldn't have been resolved and an error should have been expected here

Note

Changing a from a package to a package object or an object behaves correctly

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions