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

Fix dead test code #53416

Merged
merged 2 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -1190,8 +1190,9 @@ static void Main()
};

var substitutedSource = subst(substitutedSource0);
var compilation = CreateCompilation(substitutedSource, options: TestOptions.ReleaseExe);
var compilation = CreateCompilation(substitutedSource, options: TestOptions.ReleaseExe, targetFramework: TargetFramework.StandardLatest);
string expectedOutput;
Assert.Equal(RuntimeUtilities.IsCoreClrRuntime, compilation.Assembly.RuntimeSupportsCovariantReturnsOfClasses);
if (compilation.Assembly.RuntimeSupportsCovariantReturnsOfClasses)
{
// Correct runtime behavior with no warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4937,7 +4937,8 @@ public class Derived : Base<short, int>
public override void Method(short s, int i) { }
}
";
CSharpCompilation comp = CreateCompilation(text);
CSharpCompilation comp = CreateCompilation(text, targetFramework: TargetFramework.StandardLatest);
Assert.Equal(RuntimeUtilities.IsCoreClrRuntime, comp.Assembly.RuntimeSupportsCovariantReturnsOfClasses);
if (comp.Assembly.RuntimeSupportsDefaultInterfaceImplementation)
{
comp.VerifyDiagnostics(
Expand Down Expand Up @@ -4995,7 +4996,8 @@ class Derived : Base<int>
public override void Method(int @in, ref int @ref) { }
}
";
var compilation = CreateCompilation(text);
var compilation = CreateCompilation(text, targetFramework: TargetFramework.StandardLatest);
Assert.Equal(RuntimeUtilities.IsCoreClrRuntime, compilation.Assembly.RuntimeSupportsCovariantReturnsOfClasses);
if (compilation.Assembly.RuntimeSupportsCovariantReturnsOfClasses)
{
// We no longer report a runtime ambiguous override because the compiler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7723,7 +7723,8 @@ class D : C<int>
public override void F(int t) {} // CS0462
}
";
var comp = CreateCompilation(text);
var comp = CreateCompilation(text, targetFramework: TargetFramework.StandardLatest);
Assert.Equal(RuntimeUtilities.IsCoreClrRuntime, comp.Assembly.RuntimeSupportsCovariantReturnsOfClasses);
if (comp.Assembly.RuntimeSupportsDefaultInterfaceImplementation)
{
comp.VerifyDiagnostics(
Expand Down Expand Up @@ -18406,7 +18407,8 @@ public override void Test(string s, ref int x) { }
}
";
// We no longer report a runtime ambiguous override (CS1957) because the compiler produces a methodimpl record to disambiguate.
CSharpCompilation comp = CreateCompilation(text);
CSharpCompilation comp = CreateCompilation(text, targetFramework: TargetFramework.StandardLatest);
Assert.Equal(RuntimeUtilities.IsCoreClrRuntime, comp.Assembly.RuntimeSupportsCovariantReturnsOfClasses);
if (comp.Assembly.RuntimeSupportsDefaultInterfaceImplementation)
{
comp.VerifyDiagnostics(
Expand Down