Fix transpile crash synthesizing implicit constructor with a class-typed param - #1769
Draft
markwpearce wants to merge 1 commit into
Draft
Fix transpile crash synthesizing implicit constructor with a class-typed param#1769markwpearce wants to merge 1 commit into
markwpearce wants to merge 1 commit into
Conversation
…ped param A subclass with no explicit constructor gets one synthesized from its parent's constructor signature. The synthesized parameter list was built by deep-cloning the parent's FunctionParameterExpression nodes, but the clone is detached from the AST (no parent), so a class/enum-typed parameter's TypeExpression can no longer resolve its type by symbol lookup at transpile time - crashing in TypeExpression.transpile() on `exprType.toTypeString()` when exprType comes back undefined. This happens even for a same-namespace parent/subclass, not just across a namespace boundary as originally suspected - any custom type on an inherited, implicitly-constructed parameter crashes, since primitive types are unaffected only because they short-circuit before ever calling getType(). Resolve each such parameter's type once, while the original (still attached) parameter can still resolve it, and bake the fully-qualified name and resolved type directly into the clone via a small ResolvedTypeExpression that bypasses symbol-table resolution entirely. Fixes #1767 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
markwpearce
marked this pull request as draft
July 30, 2026 16:55
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.
Summary
ClassStatement.getTranspiledClassBody). The synthesized parameter list was built by deep-cloning the parent'sFunctionParameterExpressionnodes via.clone()- but the clone is detached from the AST (no.parent), so a class/enum-typed parameter'sTypeExpressioncan no longer resolve its type by symbol lookup at transpile time. This crashes inTypeExpression.transpile()onexprType.toTypeString()whenexprTypecomes backundefined.TypeExpression.transpile()short-circuits on the raw type name before ever callinggetType().ResolvedTypeExpressionthat bypasses symbol-table resolution entirely (so it works regardless of parenting or namespace).Fixes #1767
Test plan
bscCLI pipeline (both cross-namespace and same-namespace variants) - no crash, correct outputsrc/files/BrsFile.Class.spec.tscovering both cross-namespace and same-namespace implicit-constructor inheritance of a class-typed paramnpm run test:nocover) - 4277 passing, 0 failingnpm run lintpasses🤖 Generated with Claude Code