[nem-bug] [Nemerle 0000996]: lack of checks when "implements" is
used
feedback at nemerle.org
feedback at nemerle.org
Mon Apr 30 17:11:49 CEST 2007
A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=996>
======================================================================
Reported By: divan
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 996
Category: Compiler
Reproducibility: always
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 04-30-2007 11:39 CEST
Last Modified: 04-30-2007 17:11 CEST
======================================================================
Summary: lack of checks when "implements" is used
Description:
interface IDo {
Do() : void;
}
class A : IDo {
public //it's ok to be public
//private //compiles, but shouldn't?
//internal //compiles, fails PEVerify check
Do() : void implements IDo.Do {
}
}
Should be E: "method implementing interface member must be public and
nonstatic", for private and internal case.
======================================================================
----------------------------------------------------------------------
nazgul - 04-30-07 11:43
----------------------------------------------------------------------
The purpose of implements is to implement interfaces using private (limited
methods). The only case where it is invalid is static methods.
If internal fails to verify, then it is either bug/limitation of MS
verifier and we should maybe somehow workaround the problem.
----------------------------------------------------------------------
malekith - 04-30-07 11:45
----------------------------------------------------------------------
I suspect this is because the method is also called Do. Could you try to
rename it?
----------------------------------------------------------------------
divan - 04-30-07 11:52
----------------------------------------------------------------------
Renamed it to Doo, no changes.
Don't know if it works on Mono, but for internal case compiled program
doesn't run on windows, gives:
Unhandled Exception: System.TypeLoadException: Method 'Doo' in type 'A'
from assembly 'out, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
does not have an implementation.
at Program.Main()
Also i've just tried protected: compiles, fails PEVerify, runs ok.
----------------------------------------------------------------------
VladD2 - 04-30-07 13:49
----------------------------------------------------------------------
It's not a bug. We should close it.
----------------------------------------------------------------------
nazgul - 04-30-07 13:54
----------------------------------------------------------------------
It would be good to investigate and many report to MS as a bug.
I guess we should try to prevent generating non-verifying programs
----------------------------------------------------------------------
VladD2 - 04-30-07 15:42
----------------------------------------------------------------------
What say about it CLS/CLI standards?
----------------------------------------------------------------------
divan - 04-30-07 17:11
----------------------------------------------------------------------
Looks like i've found it in ecma-335 (Partition II 12.2 Implementing
virtual methods on interfaces)
It says in short that valid implementations are
1) public methods with the same name and signature as in interface
2) MethodImpl entry in metadata
For private MethodImpl is generated, for public it's unnecessary and not
generated, so there are no problems with these.
I can't find explicit MethodImpl generation in ncc, so it's probably done
by System.Reflection.Emit, and bug is there... but i'm not sure.
Issue History
Date Modified Username Field Change
======================================================================
04-30-07 11:39 divan New Issue
04-30-07 11:43 nazgul Note Added: 0001857
04-30-07 11:45 malekith Note Added: 0001858
04-30-07 11:52 divan Note Added: 0001859
04-30-07 13:49 VladD2 Note Added: 0001863
04-30-07 13:54 nazgul Note Added: 0001864
04-30-07 15:42 VladD2 Note Added: 0001865
04-30-07 17:11 divan Note Added: 0001866
======================================================================
More information about the bugs
mailing list