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 | 201 | SemanticError::SemanticError(const ASTNode *node, const SemanticErrorType &type, const std::string &msg, bool printErrorMessage) { | |
11 |
1/2✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 201 times.
|
201 | assert(node != nullptr); |
12 |
3/6✓ Branch 6 → 7 taken 201 times.
✗ Branch 6 → 32 not taken.
✓ Branch 7 → 8 taken 201 times.
✗ Branch 7 → 30 not taken.
✓ Branch 8 → 9 taken 201 times.
✗ Branch 8 → 28 not taken.
|
201 | errorMessage = "[Error|Semantic] " + node->codeLoc.toPrettyString() + ":\n"; |
13 |
4/8✓ Branch 13 → 14 taken 201 times.
✗ Branch 13 → 41 not taken.
✓ Branch 14 → 15 taken 201 times.
✗ Branch 14 → 39 not taken.
✓ Branch 15 → 16 taken 201 times.
✗ Branch 15 → 37 not taken.
✓ Branch 16 → 17 taken 201 times.
✗ Branch 16 → 35 not taken.
|
201 | errorMessage += getMessagePrefix(type) + ": " + msg; |
14 |
2/2✓ Branch 20 → 21 taken 199 times.
✓ Branch 20 → 27 taken 2 times.
|
201 | if (printErrorMessage) { |
15 |
1/2✓ Branch 21 → 22 taken 199 times.
✗ Branch 21 → 49 not taken.
|
199 | const std::string nodeErrorMessage = node->getErrorMessage(); |
16 |
2/4✓ Branch 22 → 23 taken 199 times.
✗ Branch 22 → 46 not taken.
✓ Branch 23 → 24 taken 199 times.
✗ Branch 23 → 44 not taken.
|
199 | errorMessage += "\n\n" + nodeErrorMessage; |
17 | 199 | } | |
18 | 201 | } | |
19 | |||
20 | /** | ||
21 | * Get the message for this particular error instance | ||
22 | * | ||
23 | * @return Error message in form of a char array | ||
24 | */ | ||
25 | 201 | 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 | 201 | std::string SemanticError::getMessagePrefix(SemanticErrorType errorType) { | |
34 |
69/104✓ Branch 2 → 3 taken 15 times.
✓ Branch 2 → 8 taken 6 times.
✓ Branch 2 → 13 taken 3 times.
✗ Branch 2 → 18 not taken.
✗ Branch 2 → 23 not taken.
✓ Branch 2 → 28 taken 2 times.
✗ Branch 2 → 33 not taken.
✗ Branch 2 → 38 not taken.
✗ Branch 2 → 43 not taken.
✓ Branch 2 → 48 taken 7 times.
✓ Branch 2 → 53 taken 3 times.
✓ Branch 2 → 58 taken 1 time.
✓ Branch 2 → 63 taken 2 times.
✓ Branch 2 → 68 taken 2 times.
✗ Branch 2 → 73 not taken.
✗ Branch 2 → 78 not taken.
✗ Branch 2 → 83 not taken.
✗ Branch 2 → 88 not taken.
✓ Branch 2 → 93 taken 2 times.
✗ Branch 2 → 98 not taken.
✗ Branch 2 → 103 not taken.
✓ Branch 2 → 108 taken 6 times.
✗ Branch 2 → 113 not taken.
✗ Branch 2 → 118 not taken.
✗ Branch 2 → 123 not taken.
✓ Branch 2 → 128 taken 1 time.
✓ Branch 2 → 133 taken 1 time.
✗ Branch 2 → 138 not taken.
✓ Branch 2 → 143 taken 1 time.
✓ Branch 2 → 148 taken 2 times.
✓ Branch 2 → 153 taken 6 times.
✓ Branch 2 → 158 taken 1 time.
✓ Branch 2 → 163 taken 2 times.
✓ Branch 2 → 168 taken 1 time.
✓ Branch 2 → 173 taken 1 time.
✓ Branch 2 → 178 taken 28 times.
✓ Branch 2 → 183 taken 2 times.
✓ Branch 2 → 188 taken 5 times.
✓ Branch 2 → 193 taken 14 times.
✓ Branch 2 → 198 taken 5 times.
✓ Branch 2 → 203 taken 1 time.
✓ Branch 2 → 208 taken 2 times.
✓ Branch 2 → 213 taken 2 times.
✓ Branch 2 → 218 taken 3 times.
✓ Branch 2 → 223 taken 2 times.
✓ Branch 2 → 228 taken 2 times.
✓ Branch 2 → 233 taken 2 times.
✓ Branch 2 → 238 taken 2 times.
✓ Branch 2 → 243 taken 6 times.
✓ Branch 2 → 248 taken 2 times.
✓ Branch 2 → 253 taken 2 times.
✓ Branch 2 → 258 taken 2 times.
✓ Branch 2 → 263 taken 1 time.
✓ Branch 2 → 268 taken 1 time.
✓ Branch 2 → 273 taken 2 times.
✗ Branch 2 → 278 not taken.
✓ Branch 2 → 283 taken 4 times.
✓ Branch 2 → 288 taken 1 time.
✓ Branch 2 → 293 taken 1 time.
✓ Branch 2 → 298 taken 1 time.
✓ Branch 2 → 303 taken 1 time.
✓ Branch 2 → 308 taken 1 time.
✓ Branch 2 → 313 taken 2 times.
✓ Branch 2 → 318 taken 1 time.
✓ Branch 2 → 323 taken 1 time.
✓ Branch 2 → 328 taken 1 time.
✓ Branch 2 → 333 taken 1 time.
✗ Branch 2 → 338 not taken.
✗ Branch 2 → 343 not taken.
✗ Branch 2 → 348 not taken.
✗ Branch 2 → 353 not taken.
✓ Branch 2 → 358 taken 2 times.
✓ Branch 2 → 363 taken 2 times.
✓ Branch 2 → 368 taken 1 time.
✓ Branch 2 → 373 taken 1 time.
✓ Branch 2 → 378 taken 2 times.
✗ Branch 2 → 383 not taken.
✗ Branch 2 → 388 not taken.
✗ Branch 2 → 393 not taken.
✓ Branch 2 → 398 taken 1 time.
✓ Branch 2 → 403 taken 1 time.
✓ Branch 2 → 408 taken 2 times.
✓ Branch 2 → 413 taken 8 times.
✓ Branch 2 → 418 taken 2 times.
✓ Branch 2 → 423 taken 4 times.
✗ Branch 2 → 428 not taken.
✓ Branch 2 → 433 taken 3 times.
✗ Branch 2 → 438 not taken.
✗ Branch 2 → 443 not taken.
✗ Branch 2 → 448 not taken.
✗ Branch 2 → 453 not taken.
✗ Branch 2 → 458 not taken.
✗ Branch 2 → 463 not taken.
✗ Branch 2 → 468 not taken.
✗ Branch 2 → 473 not taken.
✓ Branch 2 → 478 taken 1 time.
✓ Branch 2 → 483 taken 1 time.
✓ Branch 2 → 488 taken 1 time.
✓ Branch 2 → 493 taken 1 time.
✗ Branch 2 → 498 not taken.
✓ Branch 2 → 503 taken 1 time.
✓ Branch 2 → 508 taken 1 time.
✗ Branch 2 → 513 not taken.
✗ Branch 2 → 518 not taken.
|
201 | switch (errorType) { |
35 | 15 | case REFERENCED_UNDEFINED_FUNCTION: | |
36 |
1/2✓ Branch 5 → 6 taken 15 times.
✗ Branch 5 → 520 not taken.
|
30 | return "Referenced undefined function"; |
37 | 6 | case REFERENCED_UNDEFINED_VARIABLE: | |
38 |
1/2✓ Branch 10 → 11 taken 6 times.
✗ Branch 10 → 523 not taken.
|
12 | return "Referenced undefined variable"; |
39 | 3 | case REFERENCED_UNDEFINED_STRUCT: | |
40 |
1/2✓ Branch 15 → 16 taken 3 times.
✗ Branch 15 → 526 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 30 → 31 taken 2 times.
✗ Branch 30 → 535 not taken.
|
4 | return "Used before declared"; |
47 | ✗ | case FUNCTION_AMBIGUITY: | |
48 | ✗ | 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 50 → 51 taken 7 times.
✗ Branch 50 → 547 not taken.
|
14 | return "Duplicate symbol"; |
55 | 3 | case VARIABLE_DECLARED_TWICE: | |
56 |
1/2✓ Branch 55 → 56 taken 3 times.
✗ Branch 55 → 550 not taken.
|
6 | return "Multiple declarations of the same variable"; |
57 | 1 | case GLOBAL_DECLARED_TWICE: | |
58 |
1/2✓ Branch 60 → 61 taken 1 time.
✗ Branch 60 → 553 not taken.
|
2 | return "Multiple declarations of the same global variable"; |
59 | 2 | case FUNCTION_DECLARED_TWICE: | |
60 |
1/2✓ Branch 65 → 66 taken 2 times.
✗ Branch 65 → 556 not taken.
|
4 | return "Multiple declarations of a function"; |
61 | 2 | case PROCEDURE_DECLARED_TWICE: | |
62 |
1/2✓ Branch 70 → 71 taken 2 times.
✗ Branch 70 → 559 not taken.
|
4 | 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 95 → 96 taken 2 times.
✗ Branch 95 → 574 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 110 → 111 taken 6 times.
✗ Branch 110 → 583 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 130 → 131 taken 1 time.
✗ Branch 130 → 595 not taken.
|
2 | return "Duplicate enum item value"; |
87 | 1 | case GLOBAL_OF_TYPE_DYN: | |
88 |
1/2✓ Branch 135 → 136 taken 1 time.
✗ Branch 135 → 598 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 145 → 146 taken 1 time.
✗ Branch 145 → 604 not taken.
|
2 | return "Global const without value"; |
93 | 2 | case MISSING_RETURN_STMT: | |
94 |
1/2✓ Branch 150 → 151 taken 2 times.
✗ Branch 150 → 607 not taken.
|
4 | return "Missing return statement"; |
95 | 6 | case INVALID_PARAM_ORDER: | |
96 |
1/2✓ Branch 155 → 156 taken 6 times.
✗ Branch 155 → 610 not taken.
|
12 | return "Invalid argument order"; |
97 | 1 | case LAMBDA_WITH_OPTIONAL_PARAMS: | |
98 |
1/2✓ Branch 160 → 161 taken 1 time.
✗ Branch 160 → 613 not taken.
|
2 | return "Lambda with optional parameters"; |
99 | 2 | case REFERENCED_OVERLOADED_FCT: | |
100 |
1/2✓ Branch 165 → 166 taken 2 times.
✗ Branch 165 → 616 not taken.
|
4 | return "Referenced overloaded function"; |
101 | 1 | case DTOR_MUST_BE_PROCEDURE: | |
102 |
1/2✓ Branch 170 → 171 taken 1 time.
✗ Branch 170 → 619 not taken.
|
2 | return "Destructor must be a procedure"; |
103 | 1 | case DTOR_WITH_PARAMS: | |
104 |
1/2✓ Branch 175 → 176 taken 1 time.
✗ Branch 175 → 622 not taken.
|
2 | return "Destructors must not have parameters"; |
105 | 28 | case OPERATOR_WRONG_DATA_TYPE: | |
106 |
1/2✓ Branch 180 → 181 taken 28 times.
✗ Branch 180 → 625 not taken.
|
56 | return "Wrong data type for operator"; |
107 | 2 | case INVALID_ITERATOR: | |
108 |
1/2✓ Branch 185 → 186 taken 2 times.
✗ Branch 185 → 628 not taken.
|
4 | return "Invalid iterator"; |
109 | 5 | case UNEXPECTED_DYN_TYPE: | |
110 |
1/2✓ Branch 190 → 191 taken 5 times.
✗ Branch 190 → 631 not taken.
|
10 | return "Unexpected dyn type"; |
111 | 14 | case REASSIGN_CONST_VARIABLE: | |
112 |
1/2✓ Branch 195 → 196 taken 14 times.
✗ Branch 195 → 634 not taken.
|
28 | return "Cannot re-assign constant variable"; |
113 | 5 | case CONDITION_MUST_BE_BOOL: | |
114 |
1/2✓ Branch 200 → 201 taken 5 times.
✗ Branch 200 → 637 not taken.
|
10 | return "Condition must be bool"; |
115 | 1 | case SWITCH_EXPR_MUST_BE_PRIMITIVE: | |
116 |
1/2✓ Branch 205 → 206 taken 1 time.
✗ Branch 205 → 640 not taken.
|
2 | return "Switch expression of wrong type"; |
117 | 2 | case SWITCH_CASE_TYPE_MISMATCH: | |
118 |
1/2✓ Branch 210 → 211 taken 2 times.
✗ Branch 210 → 643 not taken.
|
4 | return "Case constant type does not match switch expression type"; |
119 | 2 | case MISSING_MAIN_FUNCTION: | |
120 |
1/2✓ Branch 215 → 216 taken 2 times.
✗ Branch 215 → 646 not taken.
|
4 | return "Spice programs must contain a main function"; |
121 | 3 | case FCT_PARAM_IS_TYPE_DYN: | |
122 |
1/2✓ Branch 220 → 221 taken 3 times.
✗ Branch 220 → 649 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 225 → 226 taken 2 times.
✗ Branch 225 → 652 not taken.
|
4 | return "Invalid number of break calls"; |
125 | 2 | case INVALID_CONTINUE_NUMBER: | |
126 |
1/2✓ Branch 230 → 231 taken 2 times.
✗ Branch 230 → 655 not taken.
|
4 | return "Invalid number of continue calls"; |
127 | 2 | case FALLTHROUGH_NOT_ALLOWED: | |
128 |
1/2✓ Branch 235 → 236 taken 2 times.
✗ Branch 235 → 658 not taken.
|
4 | return "Fallthrough statement not allowed here"; |
129 | 2 | case CASE_CONSTANT_INVALID_TYPE: | |
130 |
1/2✓ Branch 240 → 241 taken 2 times.
✗ Branch 240 → 661 not taken.
|
4 | return "Case constant of invalid type"; |
131 | 6 | case PRINTF_TYPE_ERROR: | |
132 |
1/2✓ Branch 245 → 246 taken 6 times.
✗ Branch 245 → 664 not taken.
|
12 | return "Types of printf call not matching"; |
133 | 2 | case PRINTF_ARG_COUNT_ERROR: | |
134 |
1/2✓ Branch 250 → 251 taken 2 times.
✗ Branch 250 → 667 not taken.
|
4 | return "Printf arg number not matching template string"; |
135 | 2 | case DUPLICATE_IMPORT_NAME: | |
136 |
1/2✓ Branch 255 → 256 taken 2 times.
✗ Branch 255 → 670 not taken.
|
4 | return "Duplicate import name"; |
137 | 2 | case IMPORTED_FILE_NOT_EXISTING: | |
138 |
1/2✓ Branch 260 → 261 taken 2 times.
✗ Branch 260 → 673 not taken.
|
4 | return "Imported source file not existing"; |
139 | 1 | case CIRCULAR_DEPENDENCY: | |
140 |
1/2✓ Branch 265 → 266 taken 1 time.
✗ Branch 265 → 676 not taken.
|
2 | return "Circular import detected"; |
141 | 1 | case ACCESS_TO_NON_EXISTING_MEMBER: | |
142 |
1/2✓ Branch 270 → 271 taken 1 time.
✗ Branch 270 → 679 not taken.
|
2 | return "Access to non-existing member"; |
143 | 2 | case INVALID_MEMBER_ACCESS: | |
144 |
1/2✓ Branch 275 → 276 taken 2 times.
✗ Branch 275 → 682 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 285 → 286 taken 4 times.
✗ Branch 285 → 688 not taken.
|
8 | return "Unknown datatype"; |
149 | 1 | case UNKNOWN_ATTR: | |
150 |
1/2✓ Branch 290 → 291 taken 1 time.
✗ Branch 290 → 691 not taken.
|
2 | return "Unknown attribute"; |
151 | 1 | case INVALID_ATTR_TARGET: | |
152 |
1/2✓ Branch 295 → 296 taken 1 time.
✗ Branch 295 → 694 not taken.
|
2 | return "Invalid attribute target"; |
153 | 1 | case MISSING_ATTR_VALUE: | |
154 |
1/2✓ Branch 300 → 301 taken 1 time.
✗ Branch 300 → 697 not taken.
|
2 | return "Missing attribute value"; |
155 | 1 | case NUMBER_OF_FIELDS_NOT_MATCHING: | |
156 |
1/2✓ Branch 305 → 306 taken 1 time.
✗ Branch 305 → 700 not taken.
|
2 | return "Number of struct fields not matching declaration"; |
157 | 1 | case FIELD_TYPE_NOT_MATCHING: | |
158 |
1/2✓ Branch 310 → 311 taken 1 time.
✗ Branch 310 → 703 not taken.
|
2 | return "The type of a field value does not match the declaration"; |
159 | 2 | case ARRAY_SIZE_INVALID: | |
160 |
1/2✓ Branch 315 → 316 taken 2 times.
✗ Branch 315 → 706 not taken.
|
4 | return "Array size invalid"; |
161 | 1 | case FOREACH_IDX_NOT_LONG: | |
162 |
1/2✓ Branch 320 → 321 taken 1 time.
✗ Branch 320 → 709 not taken.
|
2 | return "Foreach index not of type long"; |
163 | 1 | case ARRAY_INDEX_NOT_INT_OR_LONG: | |
164 |
1/2✓ Branch 325 → 326 taken 1 time.
✗ Branch 325 → 712 not taken.
|
2 | return "Array index not of type int or long"; |
165 | 1 | case ARRAY_ITEM_TYPE_NOT_MATCHING: | |
166 |
1/2✓ Branch 330 → 331 taken 1 time.
✗ Branch 330 → 715 not taken.
|
2 | return "Array item type not matching"; |
167 | 1 | case EXPECTED_ARRAY_TYPE: | |
168 |
1/2✓ Branch 335 → 336 taken 1 time.
✗ Branch 335 → 718 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 360 → 361 taken 2 times.
✗ Branch 360 → 733 not taken.
|
4 | return "Return without initialization of result variable"; |
179 | 2 | case RETURN_WITH_VALUE_IN_PROCEDURE: | |
180 |
1/2✓ Branch 365 → 366 taken 2 times.
✗ Branch 365 → 736 not taken.
|
4 | return "Return with value in procedure"; |
181 | 1 | case RETURN_OF_TEMPORARY_VALUE: | |
182 |
1/2✓ Branch 370 → 371 taken 1 time.
✗ Branch 370 → 739 not taken.
|
2 | return "Return of temporary value"; |
183 | 1 | case INVALID_STRUCT_INSTANTIATION: | |
184 |
1/2✓ Branch 375 → 376 taken 1 time.
✗ Branch 375 → 742 not taken.
|
2 | return "Invalid struct instantiation"; |
185 | 2 | case DYN_POINTERS_NOT_ALLOWED: | |
186 |
1/2✓ Branch 380 → 381 taken 2 times.
✗ Branch 380 → 745 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 400 → 401 taken 1 time.
✗ Branch 400 → 757 not taken.
|
2 | return "Dyn arrays not allowed"; |
195 | 1 | case REFERENCE_WITHOUT_INITIALIZER: | |
196 |
1/2✓ Branch 405 → 406 taken 1 time.
✗ Branch 405 → 760 not taken.
|
2 | return "Reference without initializer"; |
197 | 2 | case TEMP_TO_NON_CONST_REF: | |
198 |
1/2✓ Branch 410 → 411 taken 2 times.
✗ Branch 410 → 763 not taken.
|
4 | return "Temporary bound to non-const reference"; |
199 | 8 | case GENERIC_TYPE_NOT_IN_TEMPLATE: | |
200 |
1/2✓ Branch 415 → 416 taken 8 times.
✗ Branch 415 → 766 not taken.
|
16 | return "Generic type not contained in template"; |
201 | 2 | case QUALIFIER_AT_ILLEGAL_CONTEXT: | |
202 |
1/2✓ Branch 420 → 421 taken 2 times.
✗ Branch 420 → 769 not taken.
|
4 | return "Qualifier at illegal context"; |
203 | 4 | case INSUFFICIENT_VISIBILITY: | |
204 |
1/2✓ Branch 425 → 426 taken 4 times.
✗ Branch 425 → 772 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 435 → 436 taken 3 times.
✗ Branch 435 → 778 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 480 → 481 taken 1 time.
✗ Branch 480 → 805 not taken.
|
2 | return "Unsafe operation in safe context"; |
227 | 1 | case ASSERTION_CONDITION_BOOL: | |
228 |
1/2✓ Branch 485 → 486 taken 1 time.
✗ Branch 485 → 808 not taken.
|
2 | return "Assertion condition must be bool"; |
229 | 1 | case ARRAY_INDEX_OUT_OF_BOUNDS: | |
230 |
1/2✓ Branch 490 → 491 taken 1 time.
✗ Branch 490 → 811 not taken.
|
2 | return "Array index out of bounds"; |
231 | 1 | case EXPECTED_CONST_VARIABLE: | |
232 |
1/2✓ Branch 495 → 496 taken 1 time.
✗ Branch 495 → 814 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 505 → 506 taken 1 time.
✗ Branch 505 → 820 not taken.
|
2 | return "Test function with parameters"; |
237 | 1 | case TEST_FUNCTION_WRONG_RETURN_TYPE: | |
238 |
1/2✓ Branch 510 → 511 taken 1 time.
✗ Branch 510 → 823 not taken.
|
2 | return "Test function with wrong return type"; |
239 | ✗ | case COMING_SOON_SA: | |
240 | ✗ | return "Coming soon"; | |
241 | } | ||
242 | − | assert_fail("Unknown error"); // GCOV_EXCL_LINE | |
243 | return "Unknown error"; // GCOV_EXCL_LINE | ||
244 | } | ||
245 | |||
246 | } // namespace spice::compiler | ||
247 |