Skip to content

muDOT zoo example takes a long (infinite?) time to check #148

Closed
@namin

Description

@namin

zoo.scala is as follows:

object Test {
type Meat = {
  type IsMeat = Any
}
type Grass = {
  type IsGrass = Any
}
type Animal = {
  type Food
  def eats(food: Food): Unit
  def gets: Food
}
type Cow = {
  type IsMeat = Any
  type Food <: Grass
  def eats(food: Grass): Unit
  def gets: Grass
}
type Lion = {
  type Food = Meat
  def eats(food: Meat): Unit
  def gets: Meat
}
def newMeat: Meat = new {
  type IsMeat = Any
}
def newGrass: Grass = new {
  type IsGrass = Any
}
def newCow: Cow = new {
  type IsMeat = Any
  type Food = Grass
  def eats(food: Grass) = ()
  def gets = newGrass
}
def newLion: Lion = new {
  type Food = Meat
  def eats(food: Meat) = ()
  def gets = newMeat
}
val milka = newCow
val leo = newLion
leo.eats(milka)
}

scalac zoo.scala fails with:

zoo.scala:10: error: Parameter type in structural refinement may not
refer to a type member of that refinement
  def eats(food: Food): Unit

while dottyc zoo.scala just seems to hang.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions