-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix spurious ambiguous call error (#1057)
Bugs fixed: - Fix issue where "call is ambiguous" could be reported attempting to call certain methods (closes #1056) Technical: - Add an additional kind of test ('project tests') that are built using MSBuild and can reference other projects and packages.
- Loading branch information
Showing
22 changed files
with
359 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
] | ||
}, | ||
"ghul.compiler": { | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"commands": [ | ||
"ghul-compiler" | ||
] | ||
|
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compiler": "dotnet ../../../publish/ghul.dll", | ||
"source": [ | ||
"." | ||
] | ||
} |
23 changes: 23 additions & 0 deletions
23
project-tests/ambiguous-method-hiding-1/.vscode/tasks.json
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,23 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run test", | ||
"command": "dotnet ghul-test --use-dotnet-build \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "Capture test expectation", | ||
"command": "../../tasks/capture.sh \"${workspaceFolder}\"", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
14 changes: 14 additions & 0 deletions
14
project-tests/ambiguous-method-hiding-1/ambiguous-method-hiding.ghulproj
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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||
<GhulCompiler>dotnet ghul-compiler</GhulCompiler> | ||
<AssemblyName>binary</AssemblyName> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<GhulSources Include="**/*.ghul" /> | ||
<ProjectReference Include="../cs-test-assembly/cs-test-assembly.csproj" /> | ||
</ItemGroup> | ||
</Project> |
Empty file.
Empty file.
Empty file.
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,32 @@ | ||
will call Base().method()... | ||
---- Base.Method() | ||
Base: from Base.Method() | ||
|
||
will call Derived().method()... | ||
>>>> OverrideSameReturnType.Method() | ||
---- Base.Method() | ||
<<<< OverrideSameReturnType.Method() | ||
OverrideSameReturnType: from Base.Method() via OverrideSameReturnType.Method() | ||
|
||
will call NewSameReturnType().method()... | ||
---- NewSameReturnType.Method() | ||
NewSameReturnType: from NewSameReturnType.Method() | ||
|
||
will call NewVirtualSameReturnType().method()... | ||
---- NewVirtualSameReturnType.Method() | ||
NewVirtualSameReturnType: from NewVirtualSameReturnType.Method() | ||
|
||
will call OverrideCovariantReturnType().method()... | ||
>>>> OverrideCovariantReturnType.Method() | ||
---- Base.Method() | ||
<<<< OverrideCovariantReturnType.Method() | ||
OverrideCovariantReturnType: from Base.Method() via OverrideCovariantReturnType.Method() | ||
|
||
will call NewCovariantReturnType().method()... | ||
---- NewCovariantReturnType.Method() | ||
NewCovariantReturnType: from NewCovariantReturnType.Method() | ||
|
||
will call NewVirtualCovariantReturnType().method()... | ||
---- NewVirtualCovariantReturnType.Method() | ||
NewVirtualCovariantReturnType: from NewVirtualCovariantReturnType.Method() | ||
|
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,37 @@ | ||
namespace Test is | ||
use IO.Std.write_line; | ||
|
||
use MethodHidingAndOverriding; | ||
|
||
class Main is | ||
entry() static is | ||
write_line("will call Base().method()..."); | ||
write_line("Base: " + new Base().method()); | ||
write_line(); | ||
|
||
write_line("will call Derived().method()..."); | ||
write_line("OverrideSameReturnType: " + new OverrideSameReturnType().method()); | ||
write_line(); | ||
|
||
write_line("will call NewSameReturnType().method()..."); | ||
write_line("NewSameReturnType: " + new NewSameReturnType().method()); | ||
write_line(); | ||
|
||
write_line("will call NewVirtualSameReturnType().method()..."); | ||
write_line("NewVirtualSameReturnType: " + new NewVirtualSameReturnType().method()); | ||
write_line(); | ||
|
||
write_line("will call OverrideCovariantReturnType().method()..."); | ||
write_line("OverrideCovariantReturnType: " + new OverrideCovariantReturnType().method()); | ||
write_line(); | ||
|
||
write_line("will call NewCovariantReturnType().method()..."); | ||
write_line("NewCovariantReturnType: " + new NewCovariantReturnType().method()); | ||
write_line(); | ||
|
||
write_line("will call NewVirtualCovariantReturnType().method()..."); | ||
write_line("NewVirtualCovariantReturnType: " + new NewVirtualCovariantReturnType().method()); | ||
write_line(); | ||
si | ||
si | ||
si |
Empty file.
Empty file.
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,2 @@ | ||
**/*.sln | ||
nupkg/ |
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,65 @@ | ||
namespace MethodHidingAndOverriding { | ||
public class Base { | ||
public virtual object? Method() { | ||
System.Console.WriteLine("---- Base.Method()"); | ||
return "from Base.Method()"; | ||
} | ||
} | ||
|
||
public class OverrideSameReturnType: Base { | ||
public override object? Method() | ||
{ | ||
System.Console.WriteLine(">>>> OverrideSameReturnType.Method()"); | ||
var result = base.Method() + " via OverrideSameReturnType.Method()"; | ||
System.Console.WriteLine("<<<< OverrideSameReturnType.Method()"); | ||
|
||
return result; | ||
} | ||
} | ||
|
||
public class NewSameReturnType: Base { | ||
public new object? Method() { | ||
System.Console.WriteLine("---- NewSameReturnType.Method()"); | ||
|
||
return "from NewSameReturnType.Method()"; | ||
} | ||
} | ||
|
||
public class NewVirtualSameReturnType: Base { | ||
public virtual new object? Method() { | ||
System.Console.WriteLine("---- NewVirtualSameReturnType.Method()"); | ||
|
||
return "from NewVirtualSameReturnType.Method()"; | ||
} | ||
} | ||
|
||
public class OverrideCovariantReturnType: Base { | ||
public override string? Method() | ||
{ | ||
System.Console.WriteLine(">>>> OverrideCovariantReturnType.Method()"); | ||
var result = base.Method() + " via OverrideCovariantReturnType.Method()"; | ||
System.Console.WriteLine("<<<< OverrideCovariantReturnType.Method()"); | ||
|
||
return result; | ||
} | ||
} | ||
|
||
public class NewCovariantReturnType: Base { | ||
public new string? Method() { | ||
System.Console.WriteLine("---- NewCovariantReturnType.Method()"); | ||
|
||
return "from NewCovariantReturnType.Method()"; | ||
} | ||
} | ||
|
||
public class NewVirtualCovariantReturnType: Base { | ||
public virtual new string? Method() { | ||
System.Console.WriteLine("---- NewVirtualCovariantReturnType.Method()"); | ||
|
||
return "from NewVirtualCovariantReturnType.Method()"; | ||
} | ||
} | ||
} | ||
|
||
|
||
|
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,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<!-- <Version>1.0.4</Version> --> | ||
<PackageOutputPath>./nupkg</PackageOutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Remove="ghul.runtime" /> | ||
</ItemGroup> | ||
</Project> |
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
Oops, something went wrong.