[nem-bug] [Nemerle 0001048]: generic type constraints compatiblity

feedback at nemerle.org feedback at nemerle.org
Wed Sep 5 11:31:56 CEST 2007


A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=1048> 
======================================================================
Reported By:                BOleg
Assigned To:                
======================================================================
Project:                    Nemerle
Issue ID:                   1048
Category:                   Compiler
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
======================================================================
Date Submitted:             09-01-2007 12:02 CEST
Last Modified:              09-05-2007 11:31 CEST
======================================================================
Summary:                    generic type constraints compatiblity
Description: 
See examples:

class RefTypeA {}
class RefTypeB {}

struct StructType {}

class Test1[T1]  where T1 : Object, Int32 {} //internal compiler error:
assertion ''Set.FromList (lst).Intersect (supers).IsEmpty'' failed in file
ncc\typing\MType.n, line 1020
class Test2[T1]  where T1 : Object, StructType {} //OK (bug, reference
type and struct type
class Test3[T1]  where T1 : RefTypeA, RefTypeB {} //OK (bug, incompatible
types)
class Test4[T1]  where T1 : class, StructType {} //OK (bug, reference type
constraint and struct type)

======================================================================

----------------------------------------------------------------------
 nazgul - 09-04-07 21:20 
----------------------------------------------------------------------
Hello, I've updated your patch:
- added better recovery if wrong constraints are detected
- simplified passing functions:  'x => f(x)'  is equivalent to 'f' if
there is not co/contra-variance change
- added testcase from the bug

Unfortunately the patch breaks some existing testcases, like
class X [T] where T : struct, ISomeInterface { }

See 
positive/tyvars.n
negative/where-constraints.n

It would be really greate if you could check these tests and provide
improved patch and make sure all tests are passing, thanks.

----------------------------------------------------------------------
 BOleg - 09-05-07 11:31 
----------------------------------------------------------------------
Hello. 
- patch updated (fix for 1046 included)
- all tests OK
- added testcase for 1046

Issue History
Date Modified  Username       Field                    Change              
======================================================================
09-01-07 12:02 BOleg          New Issue                                    
09-01-07 12:02 BOleg          File Added: generics.zip                     
09-04-07 20:34 nazgul         File Added: constraints.diff                    
09-04-07 21:20 nazgul         Note Added: 0001948                          
09-04-07 21:22 nazgul         File Deleted: constraints.diff                    
09-04-07 21:22 nazgul         File Added: constraints.diff                    
09-05-07 11:31 BOleg          Note Added: 0001949                          
======================================================================




More information about the bugs mailing list