Initial commit
This commit is contained in:
13
crash_math.aura
Normal file
13
crash_math.aura
Normal file
@@ -0,0 +1,13 @@
|
||||
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
|
||||
Reference in New Issue
Block a user