Repository navigation
Wrong [CallerLineNumber] for calls without arguments - #2194
Merged
RobertvanderHulst merged 1 commit intoNov 23, 2026
Merged
Conversation
A call without arguments, e.g. Log(), got the line number of the last call without arguments in the compilation instead of its own line; in builds through the compiler server the value could even come from another project. Calls with arguments were correct. For an empty argument list ExitArgumentList attached the parse context to the shared EmptyArgumentList() node (Put() sets its XNode). Roslyn takes the caller line from the location of the argument list, which X# maps through that XNode, so every call without arguments reported the position of the last one transformed. Creating the list through the syntax factory would not help: its node cache returns the same node for the same singleton tokens. ExitArgumentList now creates a separate ArgumentListSyntax for every empty argument list (with the constructor, which bypasses the node cache) and keeps the usual tokens, so diagnostic locations do not change. Test C992: functions, typed and CLIPPER methods, a SUPER() constructor chain, DO without WITH, [CallerFilePath], and calls with arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Audit Bench Ai skipped the automatic review of this commit: The Free plan can scan 1 repository. Upgrade to Pro to scan more. |
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
A call without arguments to a method or function with a
[CallerLineNumber]parameter got the line of the last callwithout arguments in the compilation instead of its own line. In builds through the compiler server (
/shared) the valuecould even come from another project. Calls with arguments were correct. X# 3.1 shows the same behaviour.
Cause: for an empty argument list
ExitArgumentListattached the parse context to the sharedEmptyArgumentList()node(
Put()sets itsXNode). Roslyn takes the caller line from the location of the argument list, which X# maps throughthat
XNode, so every call without arguments reported the position of the last one transformed. Creating the list throughthe syntax factory does not help: its node cache returns the same node for the same singleton tokens.
The usual singleton tokens are kept, so diagnostic locations do not change.
Evidence
/dialect:Core) prints0 7 | 1 6 | 0 7; new test C992 fails(
Incorrect result in line 45).After:
0 5 | 1 6 | 0 7; C992 passes.CLIPPERmethod,a
SUPER()constructor chain andDOwithoutWITH, plus[CallerFilePath]and calls with arguments.before.
Merge Danger
Door: two-way
Blast Radius: narrow
Only argument lists of calls written without arguments get their own syntax node; what changes for users is the
[CallerLineNumber]value of such calls. The sharedEmptyArgumentList()used for compiler-generated calls is nottouched.
🤖 Generated with Claude Code