HaxeFoundation / HaxeFoundation/haxe

Type Discovery from onTypeNotFound occluded

Open
#11,330 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

There's no way to reference a real unknown type from `onTypeNotFound` unless it isn't in a module.

Say I want to build types for an existing type, and try for `import shadow.${x}` to build for type `x`:

If the type is found in module `pack.Module.ActualType` and I `Context.getType` on `pack.Module.ActualType`, the search assumes firstly `ActualType` is a property of `pack.Module`.

If I `getType` on `pack.ActualType`, there's no way of finding which module of package `pack` it might be in and I don't *think* there's a way to import.

Running through every single type via metadata a-la `tink_syntaxhub` seems rather heavy duty (and compile times confirm) where now the `onTypeNotFound` mechanism exists, as above, there's loads that can't be inferred.

The other mechanism is `onAfterTyping` which requires a complete traversal of types rather than case-by-case.

see:

[TypeLookupInconsistency.zip](https://github.com/HaxeFoundation/haxe/files/12879854/TypeLookupInconsistency.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.