Fix #16268: classify IDisposable in type-occurrence positions as Interface, not DisposableType#19809
Fix #16268: classify IDisposable in type-occurrence positions as Interface, not DisposableType#19809T-Gro wants to merge 4 commits into
Conversation
❗ Release notes required
|
T-Gro
left a comment
There was a problem hiding this comment.
Review: Looks good — clean, correct fix with solid test coverage.
The fix: Reordering isInterfaceTy before isDisposableTy is the right approach. Interface types (including IDisposable itself) should always be classified as Interface in semantic classification — the DisposableType classification is meant for concrete classes that implement IDisposable, not for interface types that happen to extend it.
Tests: Good coverage across four distinct scenarios: interface impl position, concrete disposable class (negative test guarding against regression), type constraint usage, and a custom non-IDisposable interface.
Minor nit (non-blocking): The test file is missing a trailing newline (the diff shows \ No newline at end of file).
|
@copilot : Pls add release notes |
Head branch was pushed to by a user without write access
Added in commit |
…rface, not DisposableType Reorder the classification checks in SemanticClassification.fs so that isInterfaceTy is checked before isDisposableTy. This ensures that interface types (including System.IDisposable itself) used in type-occurrence positions (e.g. `interface IDisposable with`, `#IDisposable` constraints, upcasts) are colorized as Interface rather than DisposableType. Concrete disposable classes such as MemoryStream remain classified as DisposableType via the unchanged Item.CtorGroup arm. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Description
Fixes #16268
When a type like IDisposable appears in a type-occurrence position (e.g., type annotations, interface implementations), it was being classified as DisposableType instead of Interface. This caused incorrect semantic highlighting in editors.
Changes