Pass only narrow terminal-identifier range from name resolution#19818
Pass only narrow terminal-identifier range from name resolution#19818T-Gro wants to merge 2 commits into
Conversation
|
45a6bcf to
4f5da6f
Compare
|
(this adds on a recent PR, release notes were part of it already) |
| let resolvesAsExpr = | ||
| match nameResolutionResult with | ||
| | Result (tinstEnclosing, item, mItem, mItemIdent, rest, afterRes) | ||
| | Result (tinstEnclosing, item, mItem, rest, afterRes) |
There was a problem hiding this comment.
Can this be reverted to pre-#19505, so we don't reconstruct res argument below?
| let ad = env.eAccessRights | ||
| let typeNameResInfo = GetLongIdentTypeNameInfo delayed | ||
| let (tinstEnclosing, item, mItem, mItemIdent, rest, afterResolution) = | ||
| let (tinstEnclosing, item, mItem, rest, afterResolution) = |
There was a problem hiding this comment.
Can we remove this error post-processing?
| match ResolveExprLongIdent sink ncenv wholem ad nenv typeNameResInfo lid maybeAppliedArgExpr with | ||
| | Exception e -> Exception e | ||
| | Result (tinstEnclosing, item1, rest) -> | ||
| let itemRange, itemIdentRange = ComputeItemRange wholem lid rest |
There was a problem hiding this comment.
Can ComputeItemRange return the single range, as in pre-#19505?
There was a problem hiding this comment.
They are both needed - the other goes into sink(s) for IDE functions.
This is unexpected change and adds inconsistency with the breakpoints that tooling uses. We should try to keep the debugger info as is here. I think sequence points should use the whole expression ranges? Or do they rely on typed tree ranges that are now narrowed down? |
Simplifies the type-checking pipeline by removing the wide (module-qualified)
range from resolved-item returns. Only the narrow terminal-identifier range
flows through TcItemThen and downstream functions.
Affected features: error/warning squiggles now point at the member name
(e.g. 'Member') rather than the full qualified path ('Module.Member').
IDE hover, go-to-definition, and find-all-references use the narrow range
from NameResolution sinks (unchanged). No impact on IL emission or
binary compatibility — all changed APIs are internal.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@auduchinok : It comes from the range on When stepping, why do you think it's wrong to highlight only the narrow item? Or is there another concern? |
The debugger sequence points normally cover the whole "statements" that include complete calls, arguments, and so on. Narrowing it here would create inconsistency in debugger experience. It would also be inconsistent with breakpoint ranges we provide in the tooling.
A guess: could it be because |
|
The narrowing only strips module/namespace/type prefixes from the sequence point:
But System.Console.WriteLine("hello") still gets a sequence point covering the entire call including "hello", because mWholeExpr unions the method range with the argument ranges. So I think OK? |
Revert to pre-#19505 patterns: use '_ as res' in TcNameOfExpr and pass-through binding in TcLongIdentThen instead of destructuring and reconstructing the 5-tuple. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
I really think we should not change sequence point ranges. I think we have to stay consistent with the rest of the language and C# and other languages debugging experience. Unfortunately, it seems we have to pass the two ranges to places like |
|
I also think we should keep the typed tree ranges closer to the syntax tree, so if some IDE feature work with this tree, they could also rely on these ranges. And we've been working hard on making syntax tree ranges correct 🙂 |
Follow-up to #19505 per review feedback.
Removes the wide module-qualified range from resolved-item returns. Only the narrow terminal-identifier range flows through the type-checking pipeline.
What changes for users: Error/warning squiggles now point at the member name rather than the full qualified path. Example:
What doesn't change: IDE hover, go-to-definition, find-all-references — these use ranges from NameResolution sinks which still receive the wide range internally. No impact on IL emission or binary compatibility (all changed APIs are internal).
Baseline impact
74 ranges changed across 26 test files
Operators.,NativePtr.,Seq.,M.,Option., …Color.,Class.,ILookup.,NullableClass.,ITest., …System.Int32.,System.String.,NativeInterop.NativePtr., …raio.,r1.,c.,a.,bc., …this.: 1_.(dot-lambda): 1(new Foo()).: 1CurrentDirectoryinstead ofEnvironment.CurrentDirectory