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

Diagnostics for module initializers feature #43301

Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6ebb7b0
Planned diagnostics
jnm2 Apr 12, 2020
ad85620
Accessibility diagnostics
jnm2 Apr 12, 2020
37bcdea
Signature diagnostics
jnm2 Apr 12, 2020
f6ee321
Improve readability
jnm2 Apr 12, 2020
f1f5a38
Generics diagnostics
jnm2 Apr 12, 2020
618d89a
Usages ignored without diagnostics
jnm2 Apr 12, 2020
0ae310f
Multiple application is ignored
jnm2 Apr 12, 2020
fb425a8
Couple more valid cases
jnm2 Apr 12, 2020
3153060
Diagnostic to cover the gap left by AttributeTargets.Method
jnm2 Apr 15, 2020
3255afa
Cover the gap left by AttributeTargets.Method
jnm2 Apr 15, 2020
724d23d
'Visibility' → 'Accessibility'
jnm2 Apr 30, 2020
32d8526
Group tests that vary only by keywords into theories
jnm2 Apr 30, 2020
c525661
Reserve the term 'ignored on' to indicate relying on AttributeUsage
jnm2 Apr 30, 2020
dc2ad6b
Named arguments are not relevant
jnm2 Apr 30, 2020
bdfce43
<Module> type is no longer available to VerifyIL and VerifyMemberInIL
jnm2 Apr 30, 2020
03b0c49
Fix placeholder name
jnm2 Apr 30, 2020
3f31030
Emit diagnostics should be verified
jnm2 Apr 30, 2020
22af1ab
Success cases should be executed
jnm2 May 1, 2020
b140ab9
Invalid methods should not be added as module initializers
jnm2 May 1, 2020
3328ade
Use existing helper to check accessibility
jnm2 May 1, 2020
fc412ac
Draw the line between ignored and error placements as defined by the …
jnm2 May 2, 2020
8f576b5
Mirror tests requested for mismatching AttributeTargets
jnm2 May 2, 2020
6663f90
Report additional diagnostics from accessibility check as requested
jnm2 May 2, 2020
fb488e0
Unify error messages as suggested in review, referencing WRN_MainCant…
jnm2 May 2, 2020
c36b167
Update code comments to be consistent with .resx change
jnm2 May 6, 2020
cb70fe4
Clearer message for inaccessible module initializer methods
jnm2 May 6, 2020
8212adc
Prevent false negatives when expecting a missing module initializer
jnm2 May 6, 2020
81b4d33
Make ignored constructor attribute tests more interesting
jnm2 May 6, 2020
0aba90d
Fix merge conflicts
jnm2 May 6, 2020
dc03fbe
Not accessibility tests
jnm2 May 6, 2020
a689bf4
Fix merge conflicts
jnm2 May 8, 2020
f3adf4e
Write the correct member name
jnm2 May 8, 2020
afcb701
Add tests of conditional method and attribute
jnm2 May 8, 2020
5d9c8d8
Do not emit call to method that is conditionally excluded
jnm2 May 8, 2020
64269a9
Verify that a module initializer is emitted for an extern method
jnm2 May 8, 2020
e11ff63
Use subfolder instead of partial classes
jnm2 May 9, 2020
23e81d7
Test both orders of ModuleInitializerAttribute and ConditionalAttribute
jnm2 May 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,16 @@ class C

namespace System.Runtime.CompilerServices { class ModuleInitializerAttribute : System.Attribute { } }
";
CompileAndVerify(source, parseOptions: s_parseOptions);
CompileAndVerify(
source,
parseOptions: s_parseOptions,
options: TestOptions.DebugDll.WithMetadataImportOptions(MetadataImportOptions.All),
symbolValidator: module =>
{
Assert.Equal(MetadataImportOptions.All, ((PEModuleSymbol)module).ImportOptions);
var rootModuleType = module.ContainingAssembly.GetTypeByMetadataName("<Module>");
Assert.NotNull(rootModuleType.GetMember(".cctor"));
RikkiGibson marked this conversation as resolved.
Show resolved Hide resolved
});
}

[Fact]
Expand Down