Added unary expressions to semcheck and codegen.

This commit is contained in:
2025-01-08 22:37:48 +01:00
parent 1adb289c10
commit 4053400152
25 changed files with 149 additions and 24 deletions

View File

@@ -1,8 +1,8 @@
test/functions_with_same_name.inx:2,0: error: Redeclaration of 'foo'
test/functions_with_same_name.ink:2,0: error: Redeclaration of 'foo'
 foo :: () {
^^^
test/functions_with_same_name.inx:1,0: info: Here is the first declaration of 'foo'
test/functions_with_same_name.ink:1,0: info: Here is the first declaration of 'foo'
 foo :: () {
^^^


View File

@@ -1,8 +1,8 @@
test/redeclared_variable.inx:3,0: error: Redeclaration of 'x'
test/redeclared_variable.ink:3,0: error: Redeclaration of 'x'
 x : float = 5.0
^
test/redeclared_variable.inx:2,0: info: Here is the first declaration of 'x'
test/redeclared_variable.ink:2,0: info: Here is the first declaration of 'x'
 x : float = 1.0
^


View File

@@ -1,4 +1,4 @@
test/struct_access_primitive_type.inx:3,0: error: Attempting to access a field on a primitive type 'int'.
test/struct_access_primitive_type.ink:3,0: error: Attempting to access a field on a primitive type 'int'.
x.d = 4;
^
declaration:

View File

@@ -1,4 +1,4 @@
test/type_as_variable_name.inx:2,0: error: Invalid variable name 'int'
test/type_as_variable_name.ink:2,0: error: Invalid variable name 'int'
 int : float = 4.0
^^^


10
test/semant/unary.golden Normal file
View File

@@ -0,0 +1,10 @@
scope (global) [
[pixel__ps_ps_main] : (position : float4) -> float4
[vertex__vs_vs_main] : (position : float3) -> float4
scope (vertex__vs_vs_main) [
[position] : float3
]
scope (pixel__ps_ps_main) [
[position] : float4
]
]

View File

@@ -1,4 +1,4 @@
test/undeclared_function.inx:2,0: error: Attempt to call undeclared function 'foo'.
test/undeclared_function.ink:2,0: error: Attempt to call undeclared function 'foo'.
 foo();
^^^

View File

@@ -1,4 +1,4 @@
test/undeclared_symbol.inx:2,10: error: Use of undeclared symbol 'f'
test/undeclared_symbol.ink:2,10: error: Use of undeclared symbol 'f'
 b : int = f;
^


View File

@@ -1,4 +1,4 @@
test/unknown_overload.inx:6,0: error: Procedure call did not match any of the possible overloads for 'foo'
test/unknown_overload.ink:6,0: error: Procedure call did not match any of the possible overloads for 'foo'
 found:
foo(v, v);
^^^
@@ -7,10 +7,10 @@
 foo(v, v);
^
 Possible overloads:
 foo :: (v1 : float3, v2 : float3) { (test/unknown_overload.inx:1)
 foo :: (v1 : float2, v2 : float2, v3 : float2) { (test/unknown_overload.inx:2)
 foo :: (v1 : float3, v2 : float3) { (test/unknown_overload.ink:1)
 foo :: (v1 : float2, v2 : float2, v3 : float2) { (test/unknown_overload.ink:2)
test/unknown_overload.inx:6,4: error: Type mismatch. Expected float3 got float
test/unknown_overload.ink:6,4: error: Type mismatch. Expected float3 got float
 found:
foo(v, v);
^
@@ -20,7 +20,7 @@
got:
v : float = 2.0
test/unknown_overload.inx:6,7: error: Type mismatch. Expected float3 got float
test/unknown_overload.ink:6,7: error: Type mismatch. Expected float3 got float
 found:
foo(v, v);
^

View File

@@ -1,15 +1,15 @@
test/wrong_argument_count.inx:5,19: error: Use of undeclared symbol 'w'
test/wrong_argument_count.ink:5,19: error: Use of undeclared symbol 'w'
 return x * y * z * w;
^
test/wrong_argument_count.inx:9,0: error: Procedure call did not match any of the possible overloads for 'foo'
test/wrong_argument_count.ink:9,0: error: Procedure call did not match any of the possible overloads for 'foo'
 found:
foo(2.0, 3.0);
^^^
 Possible overloads:
 foo :: (x : float, y : float, z : float) -> float { (test/wrong_argument_count.inx:1)
 foo :: (x : float, y : float, z : float) -> float { (test/wrong_argument_count.ink:1)
 Not enough arguments: Wanted 3, got 2.
 foo :: (x : float, y : float, z : float, w : float) -> float { (test/wrong_argument_count.inx:4)
 foo :: (x : float, y : float, z : float, w : float) -> float { (test/wrong_argument_count.ink:4)
 Not enough arguments: Wanted 4, got 2.

View File

@@ -1,4 +1,4 @@
test/wrong_multiply.inx:4,34: error: Type mismatch. Expected float got float2
test/wrong_multiply.ink:4,34: error: Type mismatch. Expected float got float2
 found:
result : float4 = float4(1.0, foo * res, 0.0, 1.0);
^

View File

@@ -1,4 +1,4 @@
test/wrong_type_for_function.inx:11,17: error: Procedure call did not match any of the possible overloads for 'float4'
test/wrong_type_for_function.ink:11,17: error: Procedure call did not match any of the possible overloads for 'float4'
 found:
color : float4 = float4(y, 1.0, 1.0, 1.0);
^^^^^^
@@ -7,9 +7,9 @@
 color : float4 = float4(y, 1.0, 1.0, 1.0);
^
 Possible overloads:
 foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.inx:78)
 foreign float4 :: (float, float, float, float) -> float4; (test/wrong_type_for_function.ink:78)
test/wrong_type_for_function.inx:11,24: error: Type mismatch. Expected float got float2
test/wrong_type_for_function.ink:11,24: error: Type mismatch. Expected float got float2
 found:
color : float4 = float4(y, 1.0, 1.0, 1.0);
^