[nem-bug] [Nemerle 0001018]: nonpublic virtual method in generic class

feedback at nemerle.org feedback at nemerle.org
Mon May 21 17:26:34 CEST 2007


A NOTE has been added to this issue.
======================================================================
<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-21-2007 17:26 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 :)

----------------------------------------------------------------------
 nazgul - 05-20-07 16:37 
----------------------------------------------------------------------
Or .NET Orcas... I read somewhere the Beta is out now.

----------------------------------------------------------------------
 nazgul - 05-20-07 16:38 
----------------------------------------------------------------------
Actually, it would be extremely useful if somebody test this with
http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx Orcas

----------------------------------------------------------------------
 divan - 05-21-07 17:26 
----------------------------------------------------------------------
I've just tried that .Net 3.5 beta.
It doesn't contain new version of mscorlib.dll (Reflection is here afaik)
or any other important dll.
So it doesn't help.

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                    
05-20-07 16:37 nazgul         Note Added: 0001901                          
05-20-07 16:38 nazgul         Note Added: 0001902                          
05-21-07 17:26 divan          Note Added: 0001903                          
======================================================================




More information about the bugs mailing list