Appearance
| 1 | namespace Semantic.Lookups is | |
| 2 | use IO.Std | |
| 3 | use TYPE = System.Type | |
| 4 | use Symbol = Symbols.Symbol | |
| 5 | use Type = Types.Type | |
| 6 | ||
| 7 | // Open so the unit-test assembly can stand in for it. Nothing | |
| 8 | // outside this compilation implements it otherwise. | |
| 9 | trait InnateSymbolLookup open is | |
| 10 | get_enum_type() -> Type | |
| 11 | get_tuple_type(types: Collections.List[Type], names: Collections.List[string?]?) -> Type | |
| 12 | get_function_type(types: Collections.List[Type]) -> Type | |
| 13 | ||
| 14 | // As above; `is_pure` true builds the `pure`-marked shape | |
| 15 | // (see Types.PURE_FUNCTION). The zero-argument void form has | |
| 16 | // no pure shape yet and falls back to the plain one. | |
| 17 | get_function_type(types: Collections.List[Type], is_pure: bool) -> Type | |
| 18 | ||
| 19 | get_array_type(type: Type) -> Type | |
| 20 | ||
| 21 | // The value-type `T?` — NULLABLE[type] (System.Nullable[type]). | |
| 22 | get_optional_type(type: Type) -> Type | |
| 23 | ||
| 24 | // The unconstrained-T `T?` — `Ghul.MAYBE[type]`, the | |
| 25 | // runtime struct that carries either an absent or a present | |
| 26 | // value of `type`. Null when the runtime is unavailable | |
| 27 | // (compiling `ghul-runtime` itself), mirroring | |
| 28 | // `get_unspecialized_pipe_type`: the caller | |
| 29 | // reports a clearer error than the generic | |
| 30 | // `Ghul.MAYBE not found` would. | |
| 31 | get_maybe_type(type: Type) -> Type? | |
| 32 | ||
| 33 | // `System.Collections.Generic.EqualityComparer[type]`, the | |
| 34 | // comparer a value-equality test over a bare type parameter | |
| 35 | // goes through. Null when the type cannot be resolved, leaving | |
| 36 | // the caller to report the ordinary no-operator error. | |
| 37 | get_equality_comparer_type(type: Type) -> Type? | |
| 38 | ||
| 39 | get_pointer_type(type: Type) -> Type | |
| 40 | ||
| 41 | get_reference_type(type: Type) -> Type | |
| 42 | ||
| 43 | get_bool_type() -> Type | |
| 44 | ||
| 45 | get_char_type() -> Type | |
| 46 | ||
| 47 | get_byte_type() -> Type | |
| 48 | ||
| 49 | get_ubyte_type() -> Type | |
| 50 | ||
| 51 | get_short_type() -> Type | |
| 52 | ||
| 53 | get_ushort_type() -> Type | |
| 54 | ||
| 55 | get_int_type() -> Type | |
| 56 | ||
| 57 | get_uint_type() -> Type | |
| 58 | ||
| 59 | get_long_type() -> Type | |
| 60 | ||
| 61 | get_ulong_type() -> Type | |
| 62 | ||
| 63 | get_word_type() -> Type | |
| 64 | ||
| 65 | get_uword_type() -> Type | |
| 66 | ||
| 67 | get_single_type() -> Type | |
| 68 | ||
| 69 | get_double_type() -> Type | |
| 70 | ||
| 71 | get_decimal_type() -> Type | |
| 72 | ||
| 73 | get_bigint_type() -> Type | |
| 74 | ||
| 75 | get_void_type() -> Type | |
| 76 | ||
| 77 | get_object_type() -> Type | |
| 78 | ||
| 79 | get_value_type() -> Type | |
| 80 | ||
| 81 | get_string_type() -> Type | |
| 82 | ||
| 83 | get_exception_type() -> Type | |
| 84 | ||
| 85 | get_type_type() -> Type | |
| 86 | ||
| 87 | get_unspecialized_iterable_type() -> Type | |
| 88 | get_unspecialized_list_type() -> Type | |
| 89 | ||
| 90 | get_unspecialized_iterator_type() -> Type | |
| 91 | ||
| 92 | // `Ghul.Pipes.Pipe[T]` — the required return type of a | |
| 93 | // generator function. Optional because the runtime assembly | |
| 94 | // is not loadable while the compiler is building it. Null | |
| 95 | // means "Pipe is unavailable in this compilation" and callers | |
| 96 | // fall back to the bare Iterable[T] / Iterator[T] element | |
| 97 | // extraction. | |
| 98 | get_unspecialized_pipe_type() -> Type? | |
| 99 | ||
| 100 | // Async-related types are optional for the same reason. Each | |
| 101 | // call site null-checks before using the result; the function path | |
| 102 | // returns null up the chain to mean "absent, classify this | |
| 103 | // function as non-async / skip the state-machine emission". | |
| 104 | get_unspecialized_task_type() -> Type? | |
| 105 | ||
| 106 | get_interpolated_string_handler_type() -> Type | |
| 107 | ||
| 108 | get_idisposable_type() -> Type | |
| 109 | ||
| 110 | // `System.MulticastDelegate` — the ancestry test that | |
| 111 | // recognises a .NET delegate type. Null when the type cannot | |
| 112 | // be resolved, in which case nothing is a named delegate. | |
| 113 | get_multicast_delegate_type() -> Type? | |
| 114 | ||
| 115 | // Ghul.BOX[T] — the single-field mutable cell used to | |
| 116 | // share mutation between a closure body and its enclosing | |
| 117 | // scope. The compiler's `mark-boxed-locals` pass marks | |
| 118 | // captured-and-reassigned locals; emission queries this | |
| 119 | // for the slot type and frame field type. | |
| 120 | get_box_type(type: Type) -> Type | |
| 121 | ||
| 122 | // `System.Range`, and the `Ghul.SLICE[E]` that backs the | |
| 123 | // injected `[System.Range]` indexer. | |
| 124 | get_range_type() -> Type | |
| 125 | ||
| 126 | // `Ghul.INT_RANGE` and `Ghul.INT_RANGE_INCLUSIVE`, the types `..` | |
| 127 | // and `::` produce. | |
| 128 | get_int_range_type() -> Type | |
| 129 | get_int_range_inclusive_type() -> Type | |
| 130 | ||
| 131 | // `Ghul.Pipes.slice`, which an index by a range lowers to. | |
| 132 | get_slice_functions() -> Symbols.FUNCTION_GROUP? | |
| 133 | ||
| 134 | // `Ghul.Pipes.join`, which a generator frame's ToString calls | |
| 135 | // to stringify itself the way the Pipe trait's own default does. | |
| 136 | get_join_functions() -> Symbols.FUNCTION_GROUP? | |
| 137 | ||
| 138 | // The runtime's `$`, which renders a value as text. Absent from a | |
| 139 | // runtime older than the one that introduced it. | |
| 140 | get_display_functions() -> Symbols.FUNCTION_GROUP? | |
| 141 | ||
| 142 | // `Ghul.Pipes.render_elements`, which renders a sequence as its | |
| 143 | // elements in brackets. Absent from a runtime older than the one | |
| 144 | // that introduced it. | |
| 145 | get_render_elements_functions() -> Symbols.FUNCTION_GROUP? | |
| 146 | ||
| 147 | // The `Ghul.Pipes` combinators pipe fusion recognises, keyed by | |
| 148 | // the resolved root Function with the combinator's fusion role | |
| 149 | // as the value. Empty when the runtime is unavailable, leaving | |
| 150 | // fusion declining to fire. | |
| 151 | get_pipes_fusion_functions() -> Collections.MAP[Symbols.Symbol, string] | |
| 152 | ||
| 153 | // System.Threading.Tasks.Task[T] specialised over `type`. | |
| 154 | // compile-lambdas uses it to build the inferred return-type | |
| 155 | // placeholder for `Expressions.FUNCTION`s whose body | |
| 156 | // contains a `let await` (so the synthesised continuation | |
| 157 | // lambdas inherit a `Tasks.TASK[?]` context for the | |
| 158 | // existing `T → TASK[T]` auto-wrap to fire). | |
| 159 | get_task_type(type: Type) -> Type? | |
| 160 | ||
| 161 | // The non-generic `System.Threading.Tasks.Task` — used as | |
| 162 | // the inferred return type of an async lambda that has | |
| 163 | // no value-returning `return X;` statements (every | |
| 164 | // `return;` is bare and end-of-body fallthrough produces | |
| 165 | // a completed Task). Distinct from | |
| 166 | // `get_unspecialized_task_type` which returns the open | |
| 167 | // generic `Task`1` used to recognise constructed | |
| 168 | // `Task[T]` shapes. | |
| 169 | get_void_task_type() -> Type? | |
| 170 | ||
| 171 | // `System.Runtime.CompilerServices.AsyncTaskMethodBuilder<T>` — | |
| 172 | // the builder field type on a value-async state machine. | |
| 173 | // The state machine's outer method creates the builder via | |
| 174 | // `AsyncTaskMethodBuilder<T>.Create()`, calls `Start(ref this)` | |
| 175 | // to begin MoveNext, then returns `.Task`. Each value-async | |
| 176 | // function reaches here with its result type so the builder | |
| 177 | // is instantiated correctly. | |
| 178 | get_async_task_method_builder_type(type: Type) -> Type? | |
| 179 | ||
| 180 | // The non-generic `System.Runtime.CompilerServices.AsyncTaskMethodBuilder` | |
| 181 | // for void-async (return type is the non-generic `Tasks.TASK`). | |
| 182 | get_async_task_method_builder_void_type() -> Type? | |
| 183 | ||
| 184 | // `System.Runtime.CompilerServices.IAsyncStateMachine` — | |
| 185 | // the interface the async frame implements (MoveNext + | |
| 186 | // SetStateMachine). | |
| 187 | get_async_state_machine_interface_type() -> Type? | |
| 188 | ||
| 189 | // `System.Runtime.CompilerServices.INotifyCompletion` and | |
| 190 | // `ICriticalNotifyCompletion` — an awaiter implements one of | |
| 191 | // them, and which one decides how the continuation is | |
| 192 | // registered with the builder. | |
| 193 | get_notify_completion_type() -> Type? | |
| 194 | ||
| 195 | get_critical_notify_completion_type() -> Type? | |
| 196 | ||
| 197 | si | |
| 198 | si |