Skip to content

Type members are not checked for overriding during CC #22030

Closed
@noti0na1

Description

@noti0na1

Compiler version

3.6.4-RC1-bin-20241125-0afabd6-NIGHTLY, the main branch

Minimized code

import language.experimental.modularity
import caps.*

class IO
class File

trait Abstract(tracked val io: IO^):
  type C >: CapSet <: CapSet^{io}
  def f(file: File^{C^}): Unit

class Concrete1(io: IO^) extends Abstract(io):
  type C = CapSet
  def f(file: File) = ()

class Concrete2(io1: IO^, io2: IO^) extends Abstract(io1):
  // Overriden member: type C >: CapSet <: CapSet^{io1}
  type C = CapSet^{io2} // should be error, since CapSet^{io2} !<:< CapSet^{io1}
  def f(file: File^{io2}) = ()

Output

Compiled without any error

Expectation

Should report error overriding type C in Concrete2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions