14 lines
523 B
Plaintext
14 lines
523 B
Plaintext
type PositiveTime = f32{t | t > 0.0}
|
|
|
|
pure fn simulate(dt: PositiveTime) -> f32:
|
|
// CRASH: We are subtracting a value from a constrained positive type,
|
|
// which could result in a negative number, violating the return type if we expected a PositiveTime.
|
|
// For this test, let's just pass an invalid type.
|
|
return dt
|
|
|
|
pure fn main() -> f32:
|
|
// CRASH: Trying to pass a negative literal to a PositiveTime constraint!
|
|
let invalid_time = -5.0
|
|
let result = simulate(invalid_time)
|
|
return result
|