-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Speculative semantic model - create child member models for attributes and parameter default values. #64634
Conversation
This could occur when member semantic models were used to support/represent speculative semantic models. This change gets us one step closer to addressing dotnet#60801.
…for attributes and parameter default values. Fixes dotnet#60801. Fixes dotnet#24135.
@jasonmalinowski anything in particular you wanted me to hone in on? Overall this looks fine to me :) |
@CyrusNajmabadi No; this needed some IDE reviewer and you seemed like a good choice. |
Gotcha. LGTM. |
@jcouv, @dotnet/roslyn-compiler For the second review. |
@jcouv, @dotnet/roslyn-compiler For the second review. |
using Roslyn.Utilities; | ||
|
||
namespace Microsoft.CodeAnalysis.CSharp | ||
{ |
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.
Consider adding xml doc.
nit: extra blank line below #Resolved
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.
Consider adding xml doc.
I think the name is descriptive enough and captures everything that the doc comment would say.
namespace Microsoft.CodeAnalysis.CSharp | ||
{ | ||
/// <summary> | ||
/// Instances of this <see cref="SemanticModel"/> can be exposed to external consumers. |
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.
Do we have a comment somewhere explaining why some instances should not be exposed to external customers? #Resolved
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.
Do we have a comment somewhere explaining why some instances should not be exposed to external customers?
This would violate the design.
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 didn't follow how having a comment (I'm not talking about xml doc) would violate the design.
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 didn't follow how having a comment (I'm not talking about xml doc) would violate the design.
Sorry for the confusion. I was not referring to having a comment, but to exposing other instances to external consumers. Doing that would violate the design.
(binder: containing.GetEnclosingBinder(attribute.SpanStart), model: containing)); | ||
} | ||
|
||
private MemberSemanticModel GetOrAddModelForParameter(SyntaxNode node, MemberSemanticModel containing, ParameterSyntax paramDecl) |
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 seem very close or duplicated from SyntaxTreeSemanticModel.GetOrAddModelForParameter
. Could we factorize? #Resolved
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.
Could we factorize?
I considered that, but didn't think the refactoring worth the trouble.
_parentSemanticModel = parentSemanticModel; | ||
_position = position; | ||
_parentSnapshotManagerOpt = snapshotManagerOpt; | ||
_memberModel = null!; |
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.
How is this safe? Never mind, this ctor is private, and other constructors that depend on it make sure to initialize _memberModel
. #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.
LGTM Thanks (iteration 4) with some minor comments/questions
This is a follow-up for #64634
Fixes #60801.
Fixes #24135.