Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
2 | |||
3 | #include "SemanticError.h" | ||
4 | |||
5 | #include <ast/ASTNodes.h> | ||
6 | #include <util/CodeLoc.h> | ||
7 | |||
8 | namespace spice::compiler { | ||
9 | |||
10 | 202 | SemanticError::SemanticError(const ASTNode *node, const SemanticErrorType &type, const std::string &msg, bool printErrorMessage) { | |
11 |
1/2✗ Branch 0 (4→5) not taken.
✓ Branch 1 (4→6) taken 202 times.
|
202 | assert(node != nullptr); |
12 |
3/6✓ Branch 0 (6→7) taken 202 times.
✗ Branch 1 (6→32) not taken.
✓ Branch 2 (7→8) taken 202 times.
✗ Branch 3 (7→30) not taken.
✓ Branch 4 (8→9) taken 202 times.
✗ Branch 5 (8→28) not taken.
|
202 | errorMessage = "[Error|Semantic] " + node->codeLoc.toPrettyString() + ":\n"; |
13 |
4/8✓ Branch 0 (13→14) taken 202 times.
✗ Branch 1 (13→41) not taken.
✓ Branch 2 (14→15) taken 202 times.
✗ Branch 3 (14→39) not taken.
✓ Branch 4 (15→16) taken 202 times.
✗ Branch 5 (15→37) not taken.
✓ Branch 6 (16→17) taken 202 times.
✗ Branch 7 (16→35) not taken.
|
202 | errorMessage += getMessagePrefix(type) + ": " + msg; |
14 |
2/2✓ Branch 0 (20→21) taken 200 times.
✓ Branch 1 (20→27) taken 2 times.
|
202 | if (printErrorMessage) { |
15 |
1/2✓ Branch 0 (21→22) taken 200 times.
✗ Branch 1 (21→49) not taken.
|
200 | const std::string nodeErrorMessage = node->getErrorMessage(); |
16 |
2/4✓ Branch 0 (22→23) taken 200 times.
✗ Branch 1 (22→46) not taken.
✓ Branch 2 (23→24) taken 200 times.
✗ Branch 3 (23→44) not taken.
|
200 | errorMessage += "\n\n" + nodeErrorMessage; |
17 | 200 | } | |
18 | 202 | } | |
19 | |||
20 | /** | ||
21 | * Get the message for this particular error instance | ||
22 | * | ||
23 | * @return Error message in form of a char array | ||
24 | */ | ||
25 | 202 | const char *SemanticError::what() const noexcept { return errorMessage.c_str(); } | |
26 | |||
27 | /** | ||
28 | * Get the prefix of the error message for a particular error | ||
29 | * | ||
30 | * @param errorType Type of the error | ||
31 | * @return Prefix string for the error type | ||
32 | */ | ||
33 | 202 | std::string SemanticError::getMessagePrefix(SemanticErrorType errorType) { | |
34 |
70/104✓ Branch 0 (2→3) taken 15 times.
✓ Branch 1 (2→8) taken 6 times.
✓ Branch 2 (2→13) taken 3 times.
✗ Branch 3 (2→18) not taken.
✗ Branch 4 (2→23) not taken.
✓ Branch 5 (2→28) taken 2 times.
✓ Branch 6 (2→33) taken 1 times.
✗ Branch 7 (2→38) not taken.
✗ Branch 8 (2→43) not taken.
✓ Branch 9 (2→48) taken 7 times.
✓ Branch 10 (2→53) taken 3 times.
✓ Branch 11 (2→58) taken 1 times.
✓ Branch 12 (2→63) taken 2 times.
✓ Branch 13 (2→68) taken 1 times.
✗ Branch 14 (2→73) not taken.
✗ Branch 15 (2→78) not taken.
✗ Branch 16 (2→83) not taken.
✗ Branch 17 (2→88) not taken.
✓ Branch 18 (2→93) taken 2 times.
✗ Branch 19 (2→98) not taken.
✗ Branch 20 (2→103) not taken.
✓ Branch 21 (2→108) taken 6 times.
✗ Branch 22 (2→113) not taken.
✗ Branch 23 (2→118) not taken.
✗ Branch 24 (2→123) not taken.
✓ Branch 25 (2→128) taken 1 times.
✓ Branch 26 (2→133) taken 1 times.
✗ Branch 27 (2→138) not taken.
✓ Branch 28 (2→143) taken 1 times.
✓ Branch 29 (2→148) taken 2 times.
✓ Branch 30 (2→153) taken 6 times.
✓ Branch 31 (2→158) taken 1 times.
✓ Branch 32 (2→163) taken 2 times.
✓ Branch 33 (2→168) taken 1 times.
✓ Branch 34 (2→173) taken 1 times.
✓ Branch 35 (2→178) taken 28 times.
✓ Branch 36 (2→183) taken 2 times.
✓ Branch 37 (2→188) taken 5 times.
✓ Branch 38 (2→193) taken 14 times.
✓ Branch 39 (2→198) taken 5 times.
✓ Branch 40 (2→203) taken 1 times.
✓ Branch 41 (2→208) taken 2 times.
✓ Branch 42 (2→213) taken 2 times.
✓ Branch 43 (2→218) taken 3 times.
✓ Branch 44 (2→223) taken 2 times.
✓ Branch 45 (2→228) taken 2 times.
✓ Branch 46 (2→233) taken 2 times.
✓ Branch 47 (2→238) taken 2 times.
✓ Branch 48 (2→243) taken 6 times.
✓ Branch 49 (2→248) taken 2 times.
✓ Branch 50 (2→253) taken 2 times.
✓ Branch 51 (2→258) taken 2 times.
✓ Branch 52 (2→263) taken 1 times.
✓ Branch 53 (2→268) taken 1 times.
✓ Branch 54 (2→273) taken 2 times.
✗ Branch 55 (2→278) not taken.
✓ Branch 56 (2→283) taken 4 times.
✓ Branch 57 (2→288) taken 1 times.
✓ Branch 58 (2→293) taken 1 times.
✓ Branch 59 (2→298) taken 1 times.
✓ Branch 60 (2→303) taken 1 times.
✓ Branch 61 (2→308) taken 1 times.
✓ Branch 62 (2→313) taken 3 times.
✓ Branch 63 (2→318) taken 1 times.
✓ Branch 64 (2→323) taken 1 times.
✓ Branch 65 (2→328) taken 1 times.
✓ Branch 66 (2→333) taken 1 times.
✗ Branch 67 (2→338) not taken.
✗ Branch 68 (2→343) not taken.
✗ Branch 69 (2→348) not taken.
✗ Branch 70 (2→353) not taken.
✓ Branch 71 (2→358) taken 2 times.
✓ Branch 72 (2→363) taken 2 times.
✓ Branch 73 (2→368) taken 1 times.
✓ Branch 74 (2→373) taken 1 times.
✓ Branch 75 (2→378) taken 2 times.
✗ Branch 76 (2→383) not taken.
✗ Branch 77 (2→388) not taken.
✗ Branch 78 (2→393) not taken.
✓ Branch 79 (2→398) taken 1 times.
✓ Branch 80 (2→403) taken 1 times.
✓ Branch 81 (2→408) taken 2 times.
✓ Branch 82 (2→413) taken 8 times.
✓ Branch 83 (2→418) taken 2 times.
✓ Branch 84 (2→423) taken 4 times.
✗ Branch 85 (2→428) not taken.
✓ Branch 86 (2→433) taken 3 times.
✗ Branch 87 (2→438) not taken.
✗ Branch 88 (2→443) not taken.
✗ Branch 89 (2→448) not taken.
✗ Branch 90 (2→453) not taken.
✗ Branch 91 (2→458) not taken.
✗ Branch 92 (2→463) not taken.
✗ Branch 93 (2→468) not taken.
✗ Branch 94 (2→473) not taken.
✓ Branch 95 (2→478) taken 1 times.
✓ Branch 96 (2→483) taken 1 times.
✓ Branch 97 (2→488) taken 1 times.
✓ Branch 98 (2→493) taken 1 times.
✗ Branch 99 (2→498) not taken.
✓ Branch 100 (2→503) taken 1 times.
✓ Branch 101 (2→508) taken 1 times.
✗ Branch 102 (2→513) not taken.
✗ Branch 103 (2→518) not taken.
|
202 | switch (errorType) { |
35 | 15 | case REFERENCED_UNDEFINED_FUNCTION: | |
36 |
1/2✓ Branch 0 (5→6) taken 15 times.
✗ Branch 1 (5→524) not taken.
|
30 | return "Referenced undefined function"; |
37 | 6 | case REFERENCED_UNDEFINED_VARIABLE: | |
38 |
1/2✓ Branch 0 (10→11) taken 6 times.
✗ Branch 1 (10→527) not taken.
|
12 | return "Referenced undefined variable"; |
39 | 3 | case REFERENCED_UNDEFINED_STRUCT: | |
40 |
1/2✓ Branch 0 (15→16) taken 3 times.
✗ Branch 1 (15→530) not taken.
|
6 | return "Referenced undefined struct"; |
41 | ✗ | case REFERENCED_UNDEFINED_INTERFACE: | |
42 | ✗ | return "Referenced undefined interface"; | |
43 | ✗ | case REFERENCED_UNDEFINED_FIELD: | |
44 | ✗ | return "Referenced undefined struct field"; | |
45 | 2 | case USED_BEFORE_DECLARED: | |
46 |
1/2✓ Branch 0 (30→31) taken 2 times.
✗ Branch 1 (30→539) not taken.
|
4 | return "Used before declared"; |
47 | 1 | case FUNCTION_AMBIGUITY: | |
48 |
1/2✓ Branch 0 (35→36) taken 1 times.
✗ Branch 1 (35→542) not taken.
|
2 | return "Function ambiguity"; |
49 | ✗ | case STRUCT_AMBIGUITY: | |
50 | ✗ | return "Struct ambiguity"; | |
51 | ✗ | case INTERFACE_AMBIGUITY: | |
52 | ✗ | return "Interface ambiguity"; | |
53 | 7 | case DUPLICATE_SYMBOL: | |
54 |
1/2✓ Branch 0 (50→51) taken 7 times.
✗ Branch 1 (50→551) not taken.
|
14 | return "Duplicate symbol"; |
55 | 3 | case VARIABLE_DECLARED_TWICE: | |
56 |
1/2✓ Branch 0 (55→56) taken 3 times.
✗ Branch 1 (55→554) not taken.
|
6 | return "Multiple declarations of the same variable"; |
57 | 1 | case GLOBAL_DECLARED_TWICE: | |
58 |
1/2✓ Branch 0 (60→61) taken 1 times.
✗ Branch 1 (60→557) not taken.
|
2 | return "Multiple declarations of the same global variable"; |
59 | 2 | case FUNCTION_DECLARED_TWICE: | |
60 |
1/2✓ Branch 0 (65→66) taken 2 times.
✗ Branch 1 (65→560) not taken.
|
4 | return "Multiple declarations of a function"; |
61 | 1 | case PROCEDURE_DECLARED_TWICE: | |
62 |
1/2✓ Branch 0 (70→71) taken 1 times.
✗ Branch 1 (70→563) not taken.
|
2 | return "Multiple declarations of a procedure"; |
63 | ✗ | case GENERIC_TYPE_DECLARED_TWICE: | |
64 | ✗ | return "Multiple declarations of a generic type with the same name"; | |
65 | ✗ | case STRUCT_WITH_ILLEGAL_NAME: | |
66 | ✗ | return "Struct name illegal"; | |
67 | ✗ | case STRUCT_INFINITE_SIZE: | |
68 | ✗ | return "Struct with infinite size"; | |
69 | ✗ | case STRUCT_DECLARED_TWICE: | |
70 | ✗ | return "Multiple declarations of a struct with the same name"; | |
71 | 2 | case MISSING_NO_ARGS_CTOR: | |
72 |
1/2✓ Branch 0 (95→96) taken 2 times.
✗ Branch 1 (95→578) not taken.
|
4 | return "No matching ctor found"; |
73 | ✗ | case COPY_CTOR_REQUIRED: | |
74 | ✗ | return "Missing mandatory copy ctor"; | |
75 | ✗ | case INTERFACE_DECLARED_TWICE: | |
76 | ✗ | return "Multiple declarations of an interface with the same name"; | |
77 | 6 | case INTERFACE_METHOD_NOT_IMPLEMENTED: | |
78 |
1/2✓ Branch 0 (110→111) taken 6 times.
✗ Branch 1 (110→587) not taken.
|
12 | return "Interface method not implemented"; |
79 | ✗ | case ENUM_DECLARED_TWICE: | |
80 | ✗ | return "Multiple declarations of an enum with the same name"; | |
81 | ✗ | case INVALID_SYMBOL_ACCESS: | |
82 | ✗ | return "Invalid symbol access"; | |
83 | ✗ | case DUPLICATE_ENUM_ITEM_NAME: | |
84 | ✗ | return "Duplicate enum item name"; | |
85 | 1 | case DUPLICATE_ENUM_ITEM_VALUE: | |
86 |
1/2✓ Branch 0 (130→131) taken 1 times.
✗ Branch 1 (130→599) not taken.
|
2 | return "Duplicate enum item value"; |
87 | 1 | case GLOBAL_OF_TYPE_DYN: | |
88 |
1/2✓ Branch 0 (135→136) taken 1 times.
✗ Branch 1 (135→602) not taken.
|
2 | return "Global of type dyn"; |
89 | ✗ | case GLOBAL_OF_INVALID_TYPE: | |
90 | ✗ | return "Global of invalid type"; | |
91 | 1 | case GLOBAL_CONST_WITHOUT_VALUE: | |
92 |
1/2✓ Branch 0 (145→146) taken 1 times.
✗ Branch 1 (145→608) not taken.
|
2 | return "Global const without value"; |
93 | 2 | case MISSING_RETURN_STMT: | |
94 |
1/2✓ Branch 0 (150→151) taken 2 times.
✗ Branch 1 (150→611) not taken.
|
4 | return "Missing return statement"; |
95 | 6 | case INVALID_PARAM_ORDER: | |
96 |
1/2✓ Branch 0 (155→156) taken 6 times.
✗ Branch 1 (155→614) not taken.
|
12 | return "Invalid argument order"; |
97 | 1 | case LAMBDA_WITH_OPTIONAL_PARAMS: | |
98 |
1/2✓ Branch 0 (160→161) taken 1 times.
✗ Branch 1 (160→617) not taken.
|
2 | return "Lambda with optional parameters"; |
99 | 2 | case REFERENCED_OVERLOADED_FCT: | |
100 |
1/2✓ Branch 0 (165→166) taken 2 times.
✗ Branch 1 (165→620) not taken.
|
4 | return "Referenced overloaded function"; |
101 | 1 | case DTOR_MUST_BE_PROCEDURE: | |
102 |
1/2✓ Branch 0 (170→171) taken 1 times.
✗ Branch 1 (170→623) not taken.
|
2 | return "Destructor must be a procedure"; |
103 | 1 | case DTOR_WITH_PARAMS: | |
104 |
1/2✓ Branch 0 (175→176) taken 1 times.
✗ Branch 1 (175→626) not taken.
|
2 | return "Destructors must not have parameters"; |
105 | 28 | case OPERATOR_WRONG_DATA_TYPE: | |
106 |
1/2✓ Branch 0 (180→181) taken 28 times.
✗ Branch 1 (180→629) not taken.
|
56 | return "Wrong data type for operator"; |
107 | 2 | case INVALID_ITERATOR: | |
108 |
1/2✓ Branch 0 (185→186) taken 2 times.
✗ Branch 1 (185→632) not taken.
|
4 | return "Invalid iterator"; |
109 | 5 | case UNEXPECTED_DYN_TYPE: | |
110 |
1/2✓ Branch 0 (190→191) taken 5 times.
✗ Branch 1 (190→635) not taken.
|
10 | return "Unexpected dyn type"; |
111 | 14 | case REASSIGN_CONST_VARIABLE: | |
112 |
1/2✓ Branch 0 (195→196) taken 14 times.
✗ Branch 1 (195→638) not taken.
|
28 | return "Cannot re-assign constant variable"; |
113 | 5 | case CONDITION_MUST_BE_BOOL: | |
114 |
1/2✓ Branch 0 (200→201) taken 5 times.
✗ Branch 1 (200→641) not taken.
|
10 | return "Condition must be bool"; |
115 | 1 | case SWITCH_EXPR_MUST_BE_PRIMITIVE: | |
116 |
1/2✓ Branch 0 (205→206) taken 1 times.
✗ Branch 1 (205→644) not taken.
|
2 | return "Switch expression of wrong type"; |
117 | 2 | case SWITCH_CASE_TYPE_MISMATCH: | |
118 |
1/2✓ Branch 0 (210→211) taken 2 times.
✗ Branch 1 (210→647) not taken.
|
4 | return "Case constant type does not match switch expression type"; |
119 | 2 | case MISSING_MAIN_FUNCTION: | |
120 |
1/2✓ Branch 0 (215→216) taken 2 times.
✗ Branch 1 (215→650) not taken.
|
4 | return "Spice programs must contain a main function"; |
121 | 3 | case FCT_PARAM_IS_TYPE_DYN: | |
122 |
1/2✓ Branch 0 (220→221) taken 3 times.
✗ Branch 1 (220→653) not taken.
|
6 | return "Parameter type dyn not valid in function/procedure definition without default value"; |
123 | 2 | case INVALID_BREAK_NUMBER: | |
124 |
1/2✓ Branch 0 (225→226) taken 2 times.
✗ Branch 1 (225→656) not taken.
|
4 | return "Invalid number of break calls"; |
125 | 2 | case INVALID_CONTINUE_NUMBER: | |
126 |
1/2✓ Branch 0 (230→231) taken 2 times.
✗ Branch 1 (230→659) not taken.
|
4 | return "Invalid number of continue calls"; |
127 | 2 | case FALLTHROUGH_NOT_ALLOWED: | |
128 |
1/2✓ Branch 0 (235→236) taken 2 times.
✗ Branch 1 (235→662) not taken.
|
4 | return "Fallthrough statement not allowed here"; |
129 | 2 | case CASE_CONSTANT_INVALID_TYPE: | |
130 |
1/2✓ Branch 0 (240→241) taken 2 times.
✗ Branch 1 (240→665) not taken.
|
4 | return "Case constant of invalid type"; |
131 | 6 | case PRINTF_TYPE_ERROR: | |
132 |
1/2✓ Branch 0 (245→246) taken 6 times.
✗ Branch 1 (245→668) not taken.
|
12 | return "Types of printf call not matching"; |
133 | 2 | case PRINTF_ARG_COUNT_ERROR: | |
134 |
1/2✓ Branch 0 (250→251) taken 2 times.
✗ Branch 1 (250→671) not taken.
|
4 | return "Printf arg number not matching template string"; |
135 | 2 | case DUPLICATE_IMPORT_NAME: | |
136 |
1/2✓ Branch 0 (255→256) taken 2 times.
✗ Branch 1 (255→674) not taken.
|
4 | return "Duplicate import name"; |
137 | 2 | case IMPORTED_FILE_NOT_EXISTING: | |
138 |
1/2✓ Branch 0 (260→261) taken 2 times.
✗ Branch 1 (260→677) not taken.
|
4 | return "Imported source file not existing"; |
139 | 1 | case CIRCULAR_DEPENDENCY: | |
140 |
1/2✓ Branch 0 (265→266) taken 1 times.
✗ Branch 1 (265→680) not taken.
|
2 | return "Circular import detected"; |
141 | 1 | case ACCESS_TO_NON_EXISTING_MEMBER: | |
142 |
1/2✓ Branch 0 (270→271) taken 1 times.
✗ Branch 1 (270→683) not taken.
|
2 | return "Access to non-existing member"; |
143 | 2 | case INVALID_MEMBER_ACCESS: | |
144 |
1/2✓ Branch 0 (275→276) taken 2 times.
✗ Branch 1 (275→686) not taken.
|
4 | return "Member access is only allowed on structs and Strings"; |
145 | ✗ | case SCOPE_ACCESS_ONLY_IMPORTS: | |
146 | ✗ | return "Scope access is only allowed on imports"; | |
147 | 4 | case UNKNOWN_DATATYPE: | |
148 |
1/2✓ Branch 0 (285→286) taken 4 times.
✗ Branch 1 (285→692) not taken.
|
8 | return "Unknown datatype"; |
149 | 1 | case UNKNOWN_ATTR: | |
150 |
1/2✓ Branch 0 (290→291) taken 1 times.
✗ Branch 1 (290→695) not taken.
|
2 | return "Unknown attribute"; |
151 | 1 | case INVALID_ATTR_TARGET: | |
152 |
1/2✓ Branch 0 (295→296) taken 1 times.
✗ Branch 1 (295→698) not taken.
|
2 | return "Invalid attribute target"; |
153 | 1 | case MISSING_ATTR_VALUE: | |
154 |
1/2✓ Branch 0 (300→301) taken 1 times.
✗ Branch 1 (300→701) not taken.
|
2 | return "Missing attribute value"; |
155 | 1 | case NUMBER_OF_FIELDS_NOT_MATCHING: | |
156 |
1/2✓ Branch 0 (305→306) taken 1 times.
✗ Branch 1 (305→704) not taken.
|
2 | return "Number of struct fields not matching declaration"; |
157 | 1 | case FIELD_TYPE_NOT_MATCHING: | |
158 |
1/2✓ Branch 0 (310→311) taken 1 times.
✗ Branch 1 (310→707) not taken.
|
2 | return "The type of a field value does not match the declaration"; |
159 | 3 | case ARRAY_SIZE_INVALID: | |
160 |
1/2✓ Branch 0 (315→316) taken 3 times.
✗ Branch 1 (315→710) not taken.
|
6 | return "Array size invalid"; |
161 | 1 | case FOREACH_IDX_NOT_LONG: | |
162 |
1/2✓ Branch 0 (320→321) taken 1 times.
✗ Branch 1 (320→713) not taken.
|
2 | return "Foreach index not of type long"; |
163 | 1 | case ARRAY_INDEX_NOT_INT_OR_LONG: | |
164 |
1/2✓ Branch 0 (325→326) taken 1 times.
✗ Branch 1 (325→716) not taken.
|
2 | return "Array index not of type int or long"; |
165 | 1 | case ARRAY_ITEM_TYPE_NOT_MATCHING: | |
166 |
1/2✓ Branch 0 (330→331) taken 1 times.
✗ Branch 1 (330→719) not taken.
|
2 | return "Array item type not matching"; |
167 | 1 | case EXPECTED_ARRAY_TYPE: | |
168 |
1/2✓ Branch 0 (335→336) taken 1 times.
✗ Branch 1 (335→722) not taken.
|
2 | return "Expected array type"; |
169 | ✗ | case EXPECTED_ERROR_TYPE: | |
170 | ✗ | return "Expected error type"; | |
171 | ✗ | case INVALID_SYSCALL_NUMBER_TYPE: | |
172 | ✗ | return "Invalid syscall number type"; | |
173 | ✗ | case SYSCALL_NUMBER_OUT_OF_RANGE: | |
174 | ✗ | return "Syscall number out of range"; | |
175 | ✗ | case TOO_MANY_SYSCALL_ARGS: | |
176 | ✗ | return "Too many syscall args"; | |
177 | 2 | case RETURN_WITHOUT_VALUE_RESULT: | |
178 |
1/2✓ Branch 0 (360→361) taken 2 times.
✗ Branch 1 (360→737) not taken.
|
4 | return "Return without initialization of result variable"; |
179 | 2 | case RETURN_WITH_VALUE_IN_PROCEDURE: | |
180 |
1/2✓ Branch 0 (365→366) taken 2 times.
✗ Branch 1 (365→740) not taken.
|
4 | return "Return with value in procedure"; |
181 | 1 | case RETURN_OF_TEMPORARY_VALUE: | |
182 |
1/2✓ Branch 0 (370→371) taken 1 times.
✗ Branch 1 (370→743) not taken.
|
2 | return "Return of temporary value"; |
183 | 1 | case INVALID_STRUCT_INSTANTIATION: | |
184 |
1/2✓ Branch 0 (375→376) taken 1 times.
✗ Branch 1 (375→746) not taken.
|
2 | return "Invalid struct instantiation"; |
185 | 2 | case DYN_POINTERS_NOT_ALLOWED: | |
186 |
1/2✓ Branch 0 (380→381) taken 2 times.
✗ Branch 1 (380→749) not taken.
|
4 | return "Dyn pointers not allowed"; |
187 | ✗ | case REF_POINTERS_ARE_NOT_ALLOWED: | |
188 | ✗ | return "Ref pointers not allowed"; | |
189 | ✗ | case DYN_REFERENCES_NOT_ALLOWED: | |
190 | ✗ | return "Dyn references not allowed"; | |
191 | ✗ | case MULTI_REF_NOT_ALLOWED: | |
192 | ✗ | return "Multi references not allowed"; | |
193 | 1 | case DYN_ARRAYS_NOT_ALLOWED: | |
194 |
1/2✓ Branch 0 (400→401) taken 1 times.
✗ Branch 1 (400→761) not taken.
|
2 | return "Dyn arrays not allowed"; |
195 | 1 | case REFERENCE_WITHOUT_INITIALIZER: | |
196 |
1/2✓ Branch 0 (405→406) taken 1 times.
✗ Branch 1 (405→764) not taken.
|
2 | return "Reference without initializer"; |
197 | 2 | case TEMP_TO_NON_CONST_REF: | |
198 |
1/2✓ Branch 0 (410→411) taken 2 times.
✗ Branch 1 (410→767) not taken.
|
4 | return "Temporary bound to non-const reference"; |
199 | 8 | case GENERIC_TYPE_NOT_IN_TEMPLATE: | |
200 |
1/2✓ Branch 0 (415→416) taken 8 times.
✗ Branch 1 (415→770) not taken.
|
16 | return "Generic type not contained in template"; |
201 | 2 | case QUALIFIER_AT_ILLEGAL_CONTEXT: | |
202 |
1/2✓ Branch 0 (420→421) taken 2 times.
✗ Branch 1 (420→773) not taken.
|
4 | return "Qualifier at illegal context"; |
203 | 4 | case INSUFFICIENT_VISIBILITY: | |
204 |
1/2✓ Branch 0 (425→426) taken 4 times.
✗ Branch 1 (425→776) not taken.
|
8 | return "Insufficient symbol visibility"; |
205 | ✗ | case JOIN_ARG_MUST_BE_TID: | |
206 | ✗ | return "Argument of join builtin must be a tid"; | |
207 | 3 | case EXPECTED_GENERIC_TYPE: | |
208 |
1/2✓ Branch 0 (435→436) taken 3 times.
✗ Branch 1 (435→782) not taken.
|
6 | return "Expected a generic type"; |
209 | ✗ | case EXPECTED_NON_GENERIC_TYPE: | |
210 | ✗ | return "Expected a non-generic type"; | |
211 | ✗ | case EXPECTED_STRUCT_TYPE: | |
212 | ✗ | return "Expected a struct type"; | |
213 | ✗ | case EXPECTED_INTERFACE_TYPE: | |
214 | ✗ | return "Expected an interface type"; | |
215 | ✗ | case ALIAS_WITH_TEMPLATE_LIST: | |
216 | ✗ | return "Alias with template list"; | |
217 | ✗ | case INTERFACE_WITH_TEMPLATE_LIST: | |
218 | ✗ | return "Interface reference with template list"; | |
219 | ✗ | case INVALID_TEMPLATE_TYPES: | |
220 | ✗ | return "Invalid template types"; | |
221 | ✗ | case EXPECTED_VALUE: | |
222 | ✗ | return "Expected value"; | |
223 | ✗ | case EXPECTED_TYPE: | |
224 | ✗ | return "Expected type"; | |
225 | 1 | case UNSAFE_OPERATION_IN_SAFE_CONTEXT: | |
226 |
1/2✓ Branch 0 (480→481) taken 1 times.
✗ Branch 1 (480→809) not taken.
|
2 | return "Unsafe operation in safe context"; |
227 | 1 | case ASSERTION_CONDITION_BOOL: | |
228 |
1/2✓ Branch 0 (485→486) taken 1 times.
✗ Branch 1 (485→812) not taken.
|
2 | return "Assertion condition must be bool"; |
229 | 1 | case ARRAY_INDEX_OUT_OF_BOUNDS: | |
230 |
1/2✓ Branch 0 (490→491) taken 1 times.
✗ Branch 1 (490→815) not taken.
|
2 | return "Array index out of bounds"; |
231 | 1 | case EXPECTED_CONST_VARIABLE: | |
232 |
1/2✓ Branch 0 (495→496) taken 1 times.
✗ Branch 1 (495→818) not taken.
|
2 | return "Expected const variable"; |
233 | ✗ | case DIVISION_BY_ZERO: | |
234 | ✗ | return "Division by zero"; | |
235 | 1 | case TEST_FUNCTION_WITH_PARAMS: | |
236 |
1/2✓ Branch 0 (505→506) taken 1 times.
✗ Branch 1 (505→824) not taken.
|
2 | return "Test function with parameters"; |
237 | 1 | case TEST_FUNCTION_WRONG_RETURN_TYPE: | |
238 |
1/2✓ Branch 0 (510→511) taken 1 times.
✗ Branch 1 (510→827) not taken.
|
2 | return "Test function with wrong return type"; |
239 | ✗ | case COMING_SOON_SA: | |
240 | ✗ | return "Coming soon"; | |
241 | } | ||
242 | − | return "Unknown error"; // GCOV_EXCL_LINE | |
243 | } | ||
244 | |||
245 | } // namespace spice::compiler | ||
246 |