Skip to content

TSLANG_ISSUES 18: a namespace member access looks in the namespace first - #569

Merged
ASDAlexander77 merged 1 commit into
mainfrom
fix-namespace-member-shadowed
Oct 13, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
fix-namespace-member-shadowed

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

TSLANG_ISSUES.md 18: ns.value() resolved to a local value declared earlier in the function ("not a function to call").

The namespace case of property access set the namespace current and resolved the name as an identifier, which finds locals first. It now calls resolveIdentifierInNamespace first and keeps the old lookup as the fallback.

Test: 00ns_member_shadowed.ts (function, const and nested-namespace members shadowed by locals; a local named like the namespace is still the local).

Follow-up, not changed here: a name the namespace doesn't have still falls back to the general lookup, so ns.missing with a local missing resolves to the local instead of failing.

Full Release suite with all six TSLANG_ISSUES fixes together: 4074/4074.

🤖 Generated with Claude Code

`ns.value()` after a local `const value = ...` in the same function
resolved `value` as an identifier with the namespace current, which
finds locals first: the local wasn't callable ("not a function to
call"). The access now resolves the name in the namespace first and
falls back to the old lookup.

Found in native_ts_graphics' nvrhi_direct.ts (TSLANG_ISSUES.md 18).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 199dd3a into main Oct 13, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix-namespace-member-shadowed branch October 13, 2026 17:07
ASDAlexander77 added a commit that referenced this pull request Oct 13, 2026
13, 14, 15 and 18 are fixed by #572, #568, #570 and #569. For 16, `%` is
fixed by #571 and `/` stays a number. 17 is answered (`Deref(p[i]) = v`
stores) and its error names that form since #573. 5 and 6 stay open:
they are design questions, not bugs.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
ASDAlexander77 added a commit that referenced this pull request Oct 17, 2026
* `ns.name` is the namespace's member or an error

#569 looked the name up in the namespace first, then fell back to the
general lookup, which searched the calling function's locals and the
outer namespaces: `ns.missing` with a local `missing` in scope, or
`ns.outer()` with a root-level `outer`, compiled and used those. The
access now takes only what the namespace has; a name it hasn't got is
"Can't resolve property 'missing' of type ns".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* `M.name` of `import * as M` is the module's top-level name

M is a namespace with nothing in it, whose names are declared at the top
level; the fallback the previous commit removed was how they were found.
Such a namespace is marked, and its access looks in the root namespace,
still not in the calling function's locals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant