Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No errors reported at use-site for task type with inaccessible builder type #71283

Open
cston opened this issue Dec 15, 2023 · 1 comment
Open

Comments

@cston
Copy link
Member

cston commented Dec 15, 2023

Steps to Reproduce:

Compile Example 2 from dotnet/csharpstandard#879.

See sharplab.io

Expected Behavior:

Error compiling C.M since the task builder type is inaccessible at that use-site.

Actual Behavior:

No errors.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 15, 2023
@cston
Copy link
Member Author

cston commented Dec 15, 2023

The compiler is currently checking the declared accessibility of the builder type matches exactly the declared accessibility of the task type. Instead, the compiler should simply check the builder type is accessible at the use-site of the task type.

BillWagner added a commit to BillWagner/csharpstandard that referenced this issue Dec 15, 2023
Clarify the required accessibility of any task builder type and its required members.

Note that we will need to update this text once dotnet/roslyn#71283 is fixed and merged.
BillWagner added a commit to BillWagner/csharpstandard that referenced this issue Dec 15, 2023
Clarify the required accessibility of any task builder type and its required members.

Note that we will need to update this text once dotnet/roslyn#71283 is fixed and merged.
@jaredpar jaredpar added this to the Backlog milestone Jan 3, 2024
BillWagner added a commit to dotnet/csharpstandard that referenced this issue Feb 7, 2024
* "produces a result" vs. "return a value"

Fixes #857

For an async method, say "produces a result value" vs. "return a value" when describing the rules for the returned "task type".

* Add note about identity convertible

Fixes #878

I made this a note, rather than normative language. I read the existing text to allow the example in the issue (as does the roslyn implementation).

* Describe task cancelled state

Fixes #775

Add a bullet to the list specifying that an `OperationCanceledException` puts the returned task in the cancelled state.

This meant adding `OperationCanceledException` to the types in Annex C.

I chose this fix because all known task builders conform to this behavior. It seems reasonable to standardize it.

* Fixes #879

Clarify the required accessibility of any task builder type and its required members.

Note that we will need to update this text once dotnet/roslyn#71283 is fixed and merged.

* Add clarifying note.

The normative language on exactly matching accessibility is all that's strictly needed. But, I added a note about the implications for nested types and internal types.

* Fix missing exception type.

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

* Update standard/classes.md
@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants