[nem-bug] [Nemerle 0000833]: Incorrect ambiguous
feedback at nemerle.org
feedback at nemerle.org
Sun Jan 21 20:30:09 CET 2007
A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=833>
======================================================================
Reported By: VladD2
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 833
Category: Compiler
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 01-21-2007 14:43 CET
Last Modified: 01-21-2007 20:30 CET
======================================================================
Summary: Incorrect ambiguous
Description:
public class A : System.IEquatable[A]
{
public override Equals (other : object) : bool { this == other }
public Equals (other : A) : bool { this : object == other }
}
-------------------------------------------------------------
Main.n(4,3,4,62): error : ambiguous implements-match for interface
method(s):
[method System.IEquatable.Equals(other : T.0) : bool], please
use explicit implementation
======================================================================
----------------------------------------------------------------------
VladD2 - 01-21-07 14:57
----------------------------------------------------------------------
One more example:
using System;
public class A : System.IEquatable[A]
{
}
def a = A();
def b : System.IEquatable[A] = a;
Console.WriteLine(a.Equals(a));
Console.WriteLine(a.Equals(b));
Console.WriteLine(b.Equals(a));
------------------------------------------
Compile and run OK.
----------------------------------------------------------------------
nazgul - 01-21-07 20:30
----------------------------------------------------------------------
This is because Equals (object) is a valid implementation of Equals (A)
interface method (considering contravariance)... So I would call it a
feature :)
On the other hand we could do better here and order methods by "how well"
do they match interface method and then signal error if it is still
ambiguous.
Issue History
Date Modified Username Field Change
======================================================================
01-21-07 14:43 VladD2 New Issue
01-21-07 14:57 VladD2 Note Added: 0001619
01-21-07 20:30 nazgul Note Added: 0001621
======================================================================
More information about the bugs
mailing list