Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Interceptors: handle duplicates, additional signature validation, etc. #67786
Interceptors: handle duplicates, additional signature validation, etc. #67786
Changes from 28 commits
5c4e289
b769c0e
a1f0eab
042d1d6
565c39a
f09ecb9
5edf9cf
b5fb444
732dd91
e47ce9d
678c4aa
330ae61
aec866a
4b7fa44
3534505
d2053de
d47412a
ca4cea8
21c1d56
805fc9a
87bcad6
3da2bad
f4f05aa
202914a
c677ca7
3a95687
2bfe8e2
03be70a
5c97905
b6eb568
76d66d9
f3c877e
43205e8
8664dad
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't figure out how to hit this code path in a way which also lets us verify the diagnostic which gets reported here. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we'll already have reported an error, maybe we just return null here (no interception) without reporting any additional diagnostic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trouble is, the code path used to compile methods here (through
MethodCompiler.CompileMethodBodies
instead of throughMethodCompiler.CompileMethods
) does not actually report any duplicate interception errors. This is part of why I wondered if #67786 (comment) would be better here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems unexpected to me for a
TryGet()
method to report diagnostics. (What if there are multiple calls?) If we have one specific caller where reporting a diagnostic makes the sense (and it looks like we only have one caller currently), would it make sense to simply return theOneOrMany
to the caller and have the caller report the diagnostic?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detecting the problematic condition at the call site would require returning additional information. I think it's fairly common in the compiler to report errors associated with something we are trying to get, for example, with use site diagnostics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From offline discussion, maybe this should be moved into
CompileMethodBodies
and maybeCheckDuplicateFilePaths
as well.Then the
ERR_ModuleEmitFailure
reported inTryGetInterceptor
becomes unnecessary.That's okay as a PROTOTYPE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also consider adding tests for duplicate interceptions and duplicate file paths in a compilation for ref-only assembly (showing whether or not we ran those checks).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment also seems relevant.
#67786 (comment)
Basically, the search is for a consistent place to report duplicates at the end of the declaration phase. This place would be appropriate for both duplicate file-local types and for interceptors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if it would make sense to call this in
SourceModuleSymbol.ForceComplete
, for example, after we findthis.GlobalNamespace.HasComplete(CompletionPart.MembersCompleted)
. At this point I think we should have reported declaration diagnostics for all members, and we would know if there are duplicate interceptors for a location.