forked from dnSpy/ILSpy
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request icsharpcode#2470 from icsharpcode/covariant-returns
C# 9 Covariant Returns
- Loading branch information
1 parent
f593880
commit c86a9d8
Showing
6 changed files
with
104 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
50 changes: 50 additions & 0 deletions
50
ICSharpCode.Decompiler.Tests/TestCases/Pretty/CovariantReturns.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,50 @@ | ||
namespace ICSharpCode.Decompiler.Tests.TestCases.CovariantReturns | ||
{ | ||
public abstract class Base | ||
{ | ||
public abstract Base Instance { get; } | ||
|
||
public abstract Base this[int index] { get; } | ||
|
||
public virtual Base Build() | ||
{ | ||
throw null; | ||
} | ||
|
||
protected abstract Base SetParent(object parent); | ||
} | ||
|
||
public class Derived : Base | ||
{ | ||
public override Derived Instance { get; } | ||
|
||
public override Derived this[int index] { | ||
get { | ||
throw null; | ||
} | ||
} | ||
|
||
public override Derived Build() | ||
{ | ||
throw null; | ||
} | ||
|
||
protected override Derived SetParent(object parent) | ||
{ | ||
throw null; | ||
} | ||
} | ||
|
||
public class UseSites | ||
{ | ||
public Base Test(Base x) | ||
{ | ||
return x.Build(); | ||
} | ||
|
||
public Derived Test(Derived x) | ||
{ | ||
return x.Build(); | ||
} | ||
} | ||
} |
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