Appearance
| 1 | namespace Semantic.Types is | |
| 2 | use System.Text.StringBuilder; | |
| 3 | ||
| 4 | use Source; | |
| 5 | ||
| 6 | class ERROR: Type is | |
| 7 | is_null: bool => true; | |
| 8 | is_error: bool => true; | |
| 9 | is_sentinel: bool => true; | |
| 10 | ||
| 11 | init() is | |
| 12 | super.init(); | |
| 13 | si | |
| 14 | ||
| 15 | specialize(type_map: Collections.Map[string,Type]) -> Type => self; | |
| 16 | ||
| 17 | matches(other: Type) -> bool | |
| 18 | => true; | |
| 19 | ||
| 20 | compare(other: Type) -> Types.MATCH | |
| 21 | => MATCH.ASSIGNABLE; | |
| 22 | ||
| 23 | // Leaf type for walk-based analyses, like INFERRED_VARIABLE_TYPE | |
| 24 | // and INFERRED_RETURN_TYPE. The default Type.walk(action) throws | |
| 25 | // to catch genuine bugs where compound types forget to override | |
| 26 | // — ERROR isn't a bug to catch, it's a recoverable hard-failure | |
| 27 | // marker that walk-based code (e.g. closure capture type-var | |
| 28 | // discovery) should skip without piling on another exception. | |
| 29 | // gen_type / gen_class_name DELIBERATELY inherit the default | |
| 30 | // throw — those run at IL emission, and an ERROR reaching IL | |
| 31 | // is a real bug that we want to surface (it means the logger | |
| 32 | // wasn't poisoned despite the upstream type-failure, and we'd | |
| 33 | // otherwise emit malformed IL silently). | |
| 34 | walk(action: (Type) -> void) is | |
| 35 | action(self); | |
| 36 | si | |
| 37 | ||
| 38 | to_string() -> string => "!!!"; | |
| 39 | si | |
| 40 | si |