dotnet/roslyn

Improve ERR_InaccessibleSymbol2 VB diagnostic

开放

#62,790 创建于 2022年7月20日

 (0 条评论) (0 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-CompilersConcept-Diagnostic ClarityLanguage-VBhelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

https://github.com/dotnet/roslyn/blob/d72634113d9d36c539732aaf3a188faac26dd7d7/src/Compilers/VisualBasic/Portable/VBResources.resx#L970-L972

The diagnostic can produce the following:

Error BC30389 '{0}' is not accessible in this context because it is 'Public'.

The message can be somewhat confusing, see https://github.com/dotnet/docs/issues/30235 for details.

I suggest using the effective accessibility in place of {1}, and reword it as:

Error BC30389 '{0}' is not accessible in this context because it (or one of the containing symbols) is 'Public'.

Or any other form that's less confusing.

Stackoverflow questions that see this being confused:

https://stackoverflow.com/questions/36713099/why-is-this-public-function-in-a-module-not-accessible https://stackoverflow.com/questions/35346261/new-to-nunit-getting-error-is-not-accessible-in-this-context-because-it-is

贡献者指南