Skip to content

Instantly share code, notes, and snippets.

@catamorphism
Created August 10, 2011 01:34
Show Gist options
  • Save catamorphism/1135820 to your computer and use it in GitHub Desktop.
Save catamorphism/1135820 to your computer and use it in GitHub Desktop.
// -*- rust -*-
// error-pattern:Unsatisfied precondition
tag list { cons(int, @list); nil; }
type bubu = {x: int, y: int};
pred less_than(x: int, y: int) -> bool { ret x < y; }
type ordered_range = {low: int, high: int} : less_than(*.low, *.high);
fn main() {
// Should fail to compile, b/c we're not doing the check
// explicitly that a < b
let a: int = 1;
let b: int = 2;
let c: ordered_range = {low: a, high: b};
log c.low;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment