[nem-bug] [Nemerle 0001018]: nonpublic virtual method in generic
class
feedback at nemerle.org
feedback at nemerle.org
Sun May 20 16:31:29 CEST 2007
The following issue has been CONFIRMED.
======================================================================
<http://nemerle.org/bugs/view.php?id=1018>
======================================================================
Reported By: divan
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 1018
Category: Compiler (blocked by framework)
Reproducibility: always
Severity: major
Priority: normal
Status: confirmed
======================================================================
Date Submitted: 05-19-2007 14:26 CEST
Last Modified: 05-20-2007 16:31 CEST
======================================================================
Summary: nonpublic virtual method in generic class
Description:
If nonpublic virtual method is declared in generic base then it's override
produces bad IL (at least PEVerify says that).
C# adds 'newslot' to those methods attributes, maybe it's the key, or at
least a workaround.
Ncc doesn't generate newslot for public too and it's ok, so it can be a
bug in PEVerify.
======================================================================
----------------------------------------------------------------------
divan - 05-19-07 14:56
----------------------------------------------------------------------
The same with nonpublic implementation of generic interfaces.
public interface B [T]{
f () : object
}
public class A : B [object] {
protected f () : object implements B[object].f { null; }
}
_ = (A () : B[object]).f ();
()
And even with public when implements is used
public interface B [T]{
f () : object
}
public class A : B [object] {
public ff () : object implements B[object].f { null; }
}
_ = (A () : B[object]).f ();
()
Both cases: PEVerify: [token 0x02000003] Type load failed.
[IL]: Error: [C:\nemerle_svn\bin\Debug\out.exe : bug::Main][offset
0x000000
00] Unable to resolve token.
2 Errors Verifying out.exe
----------------------------------------------------------------------
nazgul - 05-19-07 17:10
----------------------------------------------------------------------
This is the problem of .NET bug in Reflection.Emit API
----------------------------------------------------------------------
divan - 05-20-07 13:52
----------------------------------------------------------------------
Hacky workaround is to write:
public class B [T] {
internal virtual f () : T { null :> T }
}
public class A : B [object] {
internal virtual f () : object { null; } // W: use 'new' or
'override'
}
()
----------------------------------------------------------------------
divan - 05-20-07 16:31
----------------------------------------------------------------------
Another workaround is to use mono to compile such cases :)
Issue History
Date Modified Username Field Change
======================================================================
05-19-07 14:26 divan New Issue
05-19-07 14:56 divan Note Added: 0001897
05-19-07 17:10 nazgul Note Added: 0001898
05-20-07 13:52 divan Note Added: 0001899
05-20-07 16:31 divan Note Added: 0001900
05-20-07 16:31 divan Status new => confirmed
05-20-07 16:31 divan Category Compiler => Compiler
(blocked by framework)
05-20-07 16:31 divan Description Updated
05-20-07 16:31 divan Additional Information Updated
======================================================================
More information about the bugs
mailing list