Fixed some error handling for invalid if statements. Started if codegen.

This commit is contained in:
2025-01-18 22:22:16 +01:00
parent b4d119230b
commit 45ea54cf93
23 changed files with 344 additions and 11 deletions

View File

@@ -0,0 +1,6 @@
test/float_if_cond.ink:0,0: error: Type of expression in if condition has to be bool.
if 1.0
^^^
1.0 has type float


View File

@@ -0,0 +1,6 @@
test/if_cond_assign.ink:0,0: error: Type of expression in if condition has to be bool.
if 0 = 100
^^^^^^
if 0 = 100 { has type int


View File

@@ -0,0 +1,6 @@
scope (global) [
[vertex__vs_main] : (pos : float3) -> float4
scope (vertex__vs_main) [
[pos] : float3
]
]

View File

@@ -0,0 +1,6 @@
scope (global) [
[vertex__vs_main] : (pos : float3) -> float4
scope (vertex__vs_main) [
[pos] : float3
]
]

View File

@@ -7,7 +7,20 @@
 color : float4 = float4(y, 1.0, 1.0, 1.0);
^
 Possible overloads:
 foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.ink:78)
 foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.ink:86)
 foreign float4 :: (float4) -> float4; (test/wrong_type_for_function.ink:87)
 foreign float4 :: (float2, float2) -> float4; (test/wrong_type_for_function.ink:88)
 foreign float4 :: (float2, float, float) -> float4; (test/wrong_type_for_function.ink:89)
 foreign float4 :: (float, float2, float) -> float4; (test/wrong_type_for_function.ink:90)
 foreign float4 :: (float, float2, float) -> float4; (test/wrong_type_for_function.ink:90)
 foreign float4 :: (float, float, float2) -> float4; (test/wrong_type_for_function.ink:91)
 foreign float4 :: (float, float, float2) -> float4; (test/wrong_type_for_function.ink:91)
 foreign float4 :: (float3, float) -> float4; (test/wrong_type_for_function.ink:92)
 foreign float4 :: (float3, float) -> float4; (test/wrong_type_for_function.ink:92)
 foreign float4 :: (float, float3) -> float4; (test/wrong_type_for_function.ink:93)
 foreign float4 :: (float, float3) -> float4; (test/wrong_type_for_function.ink:93)
 foreign float4 :: (float) -> float4; (test/wrong_type_for_function.ink:94)
 foreign float4 :: (float) -> float4; (test/wrong_type_for_function.ink:94)
test/wrong_type_for_function.ink:11,24: error: Type mismatch. Expected float got float2
 found: