[nem-bug] [Nemerle 0000841]: Nemerle compiler does not warn if there are polymorphic types with too deep inheritance tree

feedback at nemerle.org feedback at nemerle.org
Fri Jan 26 21:48:53 CET 2007


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=841> 
======================================================================
Reported By:                nikov
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   841
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             01-26-2007 20:19 CET
Last Modified:              01-26-2007 21:48 CET
======================================================================
Summary:                    Nemerle compiler does not warn if there are
polymorphic types with too deep inheritance tree
Description: 
Nemerle compiler does not warn if there are polymorphic types with too deep
inheritance tree.

class A[T] { }
class B[T] : A[B[B[T]]] { }

_ = null : B[int]


This code produces System.TypeLoadException: A generic instantiation for
type
'A`1' from assembly 'NemerleProject, Version=1.0.0.0, Culture=neutral,
PublicKey
Token=null' was too deep.  Is this generic type defined or used
recursively?
   at _N_AutoModule.Main()

See Ecma-335, 9.2 Generics and recursive inheritance graphs
======================================================================

----------------------------------------------------------------------
 nazgul - 01-26-07 21:41 
----------------------------------------------------------------------
I try with 

class A[T] { }
class B[T] : A[B[B[B[B[B[B[B[B[B[T]]]]]]]]]] { }

_ = null : B[B[B[int]]]

and it still works for me. Are you sure this is not a runtime issue
(recursive increase of generic type size)?

----------------------------------------------------------------------
 nazgul - 01-26-07 21:48 
----------------------------------------------------------------------
Ok, I can see in the spec that this should be disallowed at all...

Issue History
Date Modified  Username       Field                    Change              
======================================================================
01-26-07 20:19 nikov          New Issue                                    
01-26-07 21:41 nazgul         Note Added: 0001649                          
01-26-07 21:48 nazgul         Note Added: 0001650                          
======================================================================




More information about the bugs mailing list