Repository navigation
A property that does not resolve is named in the error, in a condition too (#442) - #499
Merged
Merged
Conversation
…n too (#442) `if (o.foo)` on an object with no `foo` reported only "the condition has no value", and `const v = o.foo` only "can't resolve name: v", neither naming the property. The failure happens in the run that infers the function's return type (allowPartialResolve), where mlirGenPropertyAccessExpression gives success with no value and no message, so that a sibling method an object literal has not registered yet can resolve in a later run; the compile then fails in that run on what the caller makes of no value, and the run that would have said "Can't resolve property" is never reached. The access now emits "Can't resolve property 'foo' of type {x:s32}" in that run as well, still returning success. A message is shown only if the module fails to compile, and each retry cycle starts with none, so a property that resolves later costs nothing. The caller's own message ("the condition has no value") follows it. Part 1 of the issue (a.map(f).map(g) without the default library) was fixed by #443. Closes #442 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.
Part 2 of #442. Part 1,
a.map(f).map(g)without the default library, was fixed by #443.if (o.foo)on an object with nofooreported only "the condition has no value".const v = o.fooreported only "can't resolve name: v". Neither error named the property.The failure happens in the run that infers the function's return type (
allowPartialResolve). In that run,mlirGenPropertyAccessExpressionreturns success with no value and no message, so that a sibling method an object literal hasn't registered yet can resolve in a later run. The compile then fails in that same run, on what the caller makes of the missing value. The real run, which would have said "Can't resolve property", is never reached.The access now reports the error in that run too, and still returns success:
This changes nothing for a property that resolves later. A message is shown only if the module fails to compile, and each retry cycle in
processStatementsstarts with no messages.New tests
property-error/{if,const,while,conditional}.tsexpect the property's name in the error; onmainnone of these programs names it.weakref_basicis gc-only, as onmain)Closes #442
🤖 Generated with Claude Code