Nesting of Type Contexts, Type Hints, and Improved Array Typing
This MR introduces a few extensions to the typifier, allowing it to infer types for a wider range of more complex expressions. In particular, the typing of array literals and array declaration is improved significantly.
- Allow nested type contexts to be deferred by linking them to their parent contexts via inference hooks
- Introduce a system of type hints and their propagation through inference hooks in order to
- resolve type contexts from incomplete type information
- propagate fallback-to-default behaviour to nested contexts
- (possible future applications)
- Use the above to refactor and extend the type inference of array literals and subscripts:
- Array literals now fall back to the default type if no array type is known
- Inline array literals can now inherit their type from the enclosing expression's type context
- Apply the default numeric data type to arguments of
PsCast
and relationals if the argument type could not be inferred
Closes #99 (closed).
Edited by Frederik Hennig