-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add IOperation support for variations of object creation expressions … #20962
Merged
mavasani
merged 6 commits into
dotnet:features/ioperation
from
mavasani:ObjectCreations
Jul 19, 2017
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b4757ad
Add IOperation support for variations of object creation expressions …
mavasani be15288
Fix unit test
mavasani c3a9ce7
Address PR feedback from Chuck
mavasani 47b2e58
Fix unit tests that broke with previous commit
mavasani 7d068b1
Merge remote-tracking branch 'upstream/features/ioperation' into Obje…
mavasani f375fdb
Fix build break in IOperation feature branch
mavasani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using System.Linq; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
using Microsoft.CodeAnalysis.CSharp.Test.Utilities; | ||
|
@@ -1904,6 +1904,7 @@ class C2 : C1 | |
Variables: Local_1: C1 c1 | ||
Initializer: IConversionExpression (ConversionKind.Cast, Implicit) (OperationKind.ConversionExpression, Type: C1) (Syntax: 'new T()') | ||
ITypeParameterObjectCreationExpression (OperationKind.TypeParameterObjectCreationExpression, Type: T) (Syntax: 'new T()') | ||
null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this null from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is what Jinu's PR is fixing. |
||
"; | ||
var expectedDiagnostics = DiagnosticDescription.None; | ||
|
||
|
@@ -1935,6 +1936,7 @@ class C2 : C1 | |
Variables: Local_1: C1 c1 | ||
Initializer: IConversionExpression (ConversionKind.Invalid, Implicit) (OperationKind.ConversionExpression, Type: C1, IsInvalid) (Syntax: 'new T()') | ||
ITypeParameterObjectCreationExpression (OperationKind.TypeParameterObjectCreationExpression, Type: T, IsInvalid) (Syntax: 'new T()') | ||
null | ||
"; | ||
var expectedDiagnostics = new DiagnosticDescription[] { | ||
// CS0029: Cannot implicitly convert type 'T' to 'C1' | ||
|
@@ -1969,6 +1971,7 @@ static void M1<T>() | |
Variables: Local_1: I1 i1 | ||
Initializer: IConversionExpression (ConversionKind.Cast, Implicit) (OperationKind.ConversionExpression, Type: I1) (Syntax: 'new T()') | ||
ITypeParameterObjectCreationExpression (OperationKind.TypeParameterObjectCreationExpression, Type: T) (Syntax: 'new T()') | ||
null | ||
"; | ||
var expectedDiagnostics = DiagnosticDescription.None; | ||
|
||
|
@@ -1999,6 +2002,7 @@ static void M1<T>() | |
Variables: Local_1: I1 i1 | ||
Initializer: IConversionExpression (ConversionKind.Cast, Implicit) (OperationKind.ConversionExpression, Type: I1, IsInvalid) (Syntax: 'new T()') | ||
ITypeParameterObjectCreationExpression (OperationKind.TypeParameterObjectCreationExpression, Type: T, IsInvalid) (Syntax: 'new T()') | ||
null | ||
"; | ||
var expectedDiagnostics = new DiagnosticDescription[] { | ||
// CS0266: Cannot implicitly convert type 'T' to 'I1'. An explicit conversion exists (are you missing a cast?) | ||
|
@@ -2034,6 +2038,7 @@ static void M1<T, U>() | |
Variables: Local_1: U u | ||
Initializer: IConversionExpression (ConversionKind.Cast, Implicit) (OperationKind.ConversionExpression, Type: U) (Syntax: 'new T()') | ||
ITypeParameterObjectCreationExpression (OperationKind.TypeParameterObjectCreationExpression, Type: T) (Syntax: 'new T()') | ||
null | ||
"; | ||
var expectedDiagnostics = DiagnosticDescription.None; | ||
|
||
|
@@ -2065,6 +2070,7 @@ static void M1<T, U>() | |
Variables: Local_1: U u | ||
Initializer: IConversionExpression (ConversionKind.Invalid, Implicit) (OperationKind.ConversionExpression, Type: U, IsInvalid) (Syntax: 'new T()') | ||
ITypeParameterObjectCreationExpression (OperationKind.TypeParameterObjectCreationExpression, Type: T, IsInvalid) (Syntax: 'new T()') | ||
null | ||
"; | ||
var expectedDiagnostics = new DiagnosticDescription[] { | ||
// CS0029: Cannot implicitly convert type 'T' to 'U' | ||
|
Oops, something went wrong.
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.
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.
ArgumentNames
andArgumentRefKinds
should bedefault
rather thanEmpty
if not set.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 thought we need to expose non default ImmutableArray for all public APIs. @dotnet/analyzer-ioperation, what is the preference 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.
We could use
Empty
here if we're usingEmpty
in all other cases. In the bound tree though, these properties are either unset (default
) or populated with the same number of entries asArguments
.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.
Filed #20974 to discuss this at the design meeting and make the behavior consistent across the factory.