Skip to content

support bare/implicit type aliases #221

@carljm

Description

@carljm

We already support simple cases of bare type aliases (e.g. MyInt = int) if they fall out correctly from evaluating the RHS as a value expression. But for more complex (and useful!) cases (e.g. MyType = int | str) we fail because we evaluate the RHS as a value expression and it needs to be evaluated as a type expression.

This requires some heuristics to decide what assignments should be treated as type aliases. (We should explore what other type checkers do here.)

It will also require a decision about how to handle the use of something we have decided is a type alias, in a value expression. Is this forbidden? Or do we need to have two types for that particular name, one value-expression type and one type-expression type?

Metadata

Metadata

Assignees

Labels

typing semanticstyping-module features, spec compliance, etc

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions