-
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
Check language version for more scenarios #73546
Check language version for more scenarios #73546
Conversation
@@ -5853,9 +5853,9 @@ void verify(ModuleSymbol m) | |||
Assert.Equal("I1", s1.InterfacesNoUseSiteDiagnostics().Single().ToTestDisplayString()); | |||
} | |||
|
|||
CreateCompilation(src, targetFramework: TargetFramework.Net80, parseOptions: TestOptions.RegularNext).VerifyDiagnostics(); | |||
CreateCompilation(src, targetFramework: TargetFramework.Net70, parseOptions: TestOptions.RegularNext).VerifyDiagnostics(); |
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.
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.
Was there a reason to change this test to .NET7?
Just to make the scenario "stronger"
} | ||
"; | ||
var comp2 = CreateCompilation(src2, references: [comp1.ToMetadataReference()], targetFramework: s_targetFrameworkSupportingByRefLikeGenerics, parseOptions: TestOptions.Regular12); | ||
comp2.VerifyEmitDiagnostics( |
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.
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.
Why do we report an error here for
-langversion:12
usingIDisposable
, but we don't report an error for the-langversion:12
case usingIEnumerable<int>
inForeach_IEnumerableT_LanguageVersion_03
?
Semantic analysis didn't rely and still doesn't rely on conversion classification for generic IEnumerable case. I will check behavior in main if it runs into problems elsewhere and will follow up separately, if needed.
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.
Besides, Foreach_IEnumerableT_LanguageVersion_03
doesn't dispose a ref struct
} | ||
"; | ||
var comp2 = CreateCompilation(src2, references: [comp1.ToMetadataReference()], targetFramework: s_targetFrameworkSupportingByRefLikeGenerics, parseOptions: TestOptions.Regular12); | ||
comp2.VerifyEmitDiagnostics(); |
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.
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.
Why does this case succeed but the corresponding
-langversion:12
case inForeach_IEnumerable_LanguageVersion_03
fails?
Semantic analysis didn't rely and still doesn't rely on conversion classification for generic IEnumerable case. I will check behavior in main if it runs into problems elsewhere and will follow up separately, if needed.
static void Main() | ||
{ | ||
System.Console.Write((new S() { 200, 40, 6 }).P); | ||
} |
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.
Was the intent to run the code for the success cases? #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.
Was the intent to run the code for the success cases?
No. Execution is covered by other tests. I think ObjectCreation_05
in this particular case
@jjonescz, @dotnet/roslyn-compiler For the second review |
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.
Done review pass. Only a couple of minor questions.
if (needSupportForRefStructInterfaces && | ||
initializerType.ContainingModule != Compilation.SourceModule) | ||
{ | ||
CheckFeatureAvailability(node, MessageID.IDS_FeatureRefStructInterfaces, 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.
Nit: this check is used in several places. Could we consider extracting a helper CheckFeatureAvailabilityForUsage
or soemthing similar? #WontFix
} | ||
|
||
[Fact] | ||
public void Using_LanguageVersion_04() |
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.
Nit: straight from 2 to 4? #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.
Nit: straight from 2 to 4?
There is no requirement to avoid gaps in numbers. There is a reason, however, the number matches the other test that covers similar scenario.
} | ||
"; | ||
|
||
var comp1 = CreateCompilation(src1, targetFramework: s_targetFrameworkSupportingByRefLikeGenerics); |
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.
Why aren't we checking langversion on implementation? Or is that forthcoming? #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.
Why aren't we checking langversion on implementation? Or is that forthcoming?
Because this isn't a goal for this PR. I assume you are referring to a scenario covered in ImplementAnInterface_01
.
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.
Yes, thanks for clarifying.
} | ||
|
||
[Fact] | ||
public void Foreach_IEnumerableT_LanguageVersion_03() |
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.
Nit: straight from 1 to 3? #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.
Nit: straight from 1 to 3?
Same response
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.
Done review pass. Only a couple of minor questi
71887d8
into
dotnet:features/RefStructInterfaces
No description provided.