Fix SynType.CreateApp throwing "unexpected type: App"#198
Merged
Conversation
Co-authored-by: 7sharp9 <588746+7sharp9@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix error when using SynType.CreateApp due to missing arguments
Fix SynType.CreateApp throwing "unexpected type: App"
Feb 25, 2026
There was a problem hiding this comment.
Pull request overview
Fixes runtime failures when constructing SynType.App nodes via SynType.CreateApp by providing the required angle-bracket ranges, aligning with the rest of AstExtensions’ SynType.App helpers.
Changes:
- Update
SynType.CreateAppto passSome range0for bothlessRangeandgreaterRangewhen buildingSynType.App.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| type SynType with | ||
| static member CreateApp (typ, args, ?isPostfix) = | ||
| SynType.App(typ, None, args, dotsOrCommas args, None, (defaultArg isPostfix false), range0) | ||
| SynType.App(typ, Some range0, args, dotsOrCommas args, Some range0, (defaultArg isPostfix false), range0) |
There was a problem hiding this comment.
This SynType.App invocation is still using positional arguments, while every other SynType.App call in this file uses named arguments (typeName=, lessRange=, greaterRange=, etc.). Consider switching this helper to named arguments as well to make the parameter intent explicit and reduce the chance of future FCS signature changes silently breaking the call again.
Suggested change
| SynType.App(typ, Some range0, args, dotsOrCommas args, Some range0, (defaultArg isPostfix false), range0) | |
| SynType.App( | |
| typeName = typ, | |
| lessRange = Some range0, | |
| typeArgs = args, | |
| commaRanges = dotsOrCommas args, | |
| greaterRange = Some range0, | |
| isPostfix = defaultArg isPostfix false, | |
| range = range0 | |
| ) |
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.
SynType.CreateAppwas passingNoneforlessRangeandgreaterRangein theSynType.Appconstructor, causing anSystem.Exception: unexpected type: Appat runtime whenisPostfixis false and angle-bracket ranges are expected.Change
AstExtensions.fs: replaceNonewithSome range0for bothlessRangeandgreaterRangeinSynType.CreateApp, consistent with every otherSynType.Appcall in the same file (Option,ResizeArray,Set,Map,List, etc.)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.