Repository navigation
ns.name is the namespace's member or an error - #580
Merged
Merged
Conversation
#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 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#569 looked a qualified name up in the namespace first, then fell back to the general lookup. That lookup searched the calling function's locals and the outer namespaces too, so these compiled and used the wrong thing:
resolveIdentifierInNamespacefinds; a miss goes on to the usual "Can't resolve property" error (partial-resolve runs keep their non-fatal path).import * as MmakesMan empty namespace whose names are declared at the top level; the fallback was howM.addfound them. Such a namespace is now markedisModuleImport, and its access looks in the root namespace, still never in locals.Tests:
namespace-member/missing_member.ts,namespace-member/outer_member.ts: error text and position.00ns_member_shadowed.ts: a member used before its declaration, and one from a secondnamespace ns2 {}block.import-bindings/import_namespace.ts:M.ANSWERwith a localANSWERin scope.Full Release suite: 4091/4091 passed. The first run without the
import * as Mhandling failed only the threeimport-bindings-namespacetests.🤖 Generated with Claude Code