Skip to content

fix: type assertion property access warning to error + loc propagation#195

Merged
cs01 merged 2 commits intomainfrom
fix/type-assertion-loc-propagation
Mar 10, 2026
Merged

fix: type assertion property access warning to error + loc propagation#195
cs01 merged 2 commits intomainfrom
fix/type-assertion-loc-propagation

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 10, 2026

Summary

  • Property access on type assertion expressions that can't be resolved now produces a compile error instead of silently returning 0.0 (wrong value at runtime)
  • Synthetic member access expressions created during type assertion resolution now carry source location info for accurate error messages
  • Fixed redundant as VariableDeclaration casts in escape-analysis.ts that were silently returning 0.0 for .loc access

Changes

  • member.ts: Added loc: expr.loc to both synthetic expression creation sites in handleTypeAssertionPropertyAccess
  • member.ts: Converted emitWarning + return "0.0" to emitError for unresolved type_assertion properties
  • escape-analysis.ts: Removed redundant type assertions that triggered the type_assertion property handler

Test plan

  • All tests pass
  • Self-hosting Stage 0 + Stage 1 pass

@cs01 cs01 merged commit 52d9926 into main Mar 10, 2026
12 checks passed
@cs01 cs01 deleted the fix/type-assertion-loc-propagation branch March 12, 2026 05:35
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