F32 is default float, operator overloads turn literals into default types
This commit is contained in:
@@ -8,9 +8,29 @@ len : S64
|
||||
*(result.data->*S64) = *(a.data->*S64) + *(b.data->*S64)
|
||||
return result
|
||||
|
||||
"+" :: (a: Any, b: S64): Any
|
||||
result: Any = storage[len++]
|
||||
if a.type == S64
|
||||
*(result.data->*S64) = *(a.data->*S64) + b
|
||||
return result
|
||||
|
||||
"==" :: (a: Any, b: S64): Bool
|
||||
result := false
|
||||
if a.type == S64
|
||||
result = *(a.data->*S64) == b
|
||||
return result
|
||||
|
||||
"==" :: (a: Any, b: Any): Bool
|
||||
result := false
|
||||
if a.type == S64 && b.type == S64
|
||||
result = *(a.data->*S64) == *(b.data->*S64)
|
||||
return result
|
||||
|
||||
main :: (): int
|
||||
a: Any = 10
|
||||
b: Any = 20
|
||||
c := a + b
|
||||
Assert(c.type == S64 && *(c.data->*S64) == 30)
|
||||
Assert(c.type == S64 && c == 30)
|
||||
Assert(a+b+a==c+(5+5))
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user