-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[class] DIMs in the vtable of abstract classes may be overridden (#82556
) * [class] treat slot as empty if it's filled in with a DIM Classes may override an interface method slot if it was filled in with a DIM, just as if it was empty. Related to #81882
- Loading branch information
1 parent
366e77d
commit 4862343
Showing
5 changed files
with
95 additions
and
2 deletions.
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
44 changes: 44 additions & 0 deletions
44
src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github81882.cs
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Linq; | ||
|
||
using Xunit; | ||
|
||
namespace LeaveAbstractMethodsNulInVTable | ||
{ | ||
interface IDefault | ||
{ | ||
public string Method1() => "Interface Method1"; | ||
|
||
public string Method2() => "Interface Method2"; | ||
} | ||
|
||
abstract class ClassA : IDefault | ||
{ | ||
virtual public string Method1() => "ClassA Method1"; | ||
} | ||
|
||
class ClassB : ClassA | ||
{ | ||
virtual public string Method2() => "ClassB Method2"; | ||
} | ||
|
||
public class Program | ||
{ | ||
public static int Main() | ||
{ | ||
IDefault c = new ClassB(); | ||
|
||
string s1 = c.Method1(); | ||
Assert.Equal("ClassA Method1", s1); | ||
|
||
string s2 = c.Method2(); | ||
Assert.Equal("ClassB Method2", s2); | ||
|
||
return 100; | ||
} | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/tests/Loader/classloader/DefaultInterfaceMethods/regressions/github81882.csproj
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<OutputType>Exe</OutputType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="$(MSBuildProjectName).cs" /> | ||
</ItemGroup> | ||
</Project> |