Skip to content

A private or protected member used from outside its class is one error, in tsc's words - #1133

Merged
ASDAlexander77 merged 1 commit into
mainfrom
private-access-diagnostic
Dec 5, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
private-access-diagnostic

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

t.v of constructor(private v: number) used to give four errors for one access:

error: Class member "v" is not accessable
error: can't resolve property/field/base 'v' of class 'T'
error: Class member 'v' can't be found
error: Can't resolve property 'v' of type T

Now it gives one: Property 'v' is private and only accessible within class 'T'. A protected member gets ... and its subclasses added. This covers fields, methods, static fields, stores and t?.v. The lookups that run after a denied access stay quiet (the field path uses the property-access logic's flag; the method and static paths compare the access's location). The t?.v trial lookup ignores its own errors, so this path repeats the stored message. "Class constructor is not accessible" now has the right spelling.

Tests: access-errors/ has six cases. Each one fails if any follow-up error appears. Full ctest passes: 10556/10556.

🤖 Generated with Claude Code

…r, in tsc's words

`t.v` of `constructor(private v: number)` gave four errors: "Class member "v" is not accessable", then "can't
resolve property/field/base", "Class member 'v' can't be found" and "Can't resolve property 'v' of type T". Now it is
"Property 'v' is private and only accessible within class 'T'" (protected: "... and its subclasses") for fields,
methods, static fields, stores and `t?.v`, and the lookups after it say nothing more of that access. "Class
constructor is not accessible" is spelled right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 74b5c3c into main Dec 5, 2026
11 of 12 checks passed
@ASDAlexander77
ASDAlexander77 deleted the private-access-diagnostic branch December 5, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant