tadeuzagallo / verve-lang

A functional language for the working hacker
https://verve-lang.org
MIT License
346 stars 7 forks source link

Pattern match doesn't check type #27

Closed tadeuzagallo closed 8 years ago

tadeuzagallo commented 8 years ago

Right now only the tag of the constructor is check, but not to which type does it belong, e.g.

type Foo { X(Int) }
type Bar { Y(Int) }

_(x: Foo): Void {
  let Y(y) = x {
    print(y)
  }
}(X(42))

The type checker should be able to catch that it's being matched with a constructor that belongs to a different type.