[nem-bug] [Nemerle 0000790]: Wrong error message when trying to access nested variant subtype

feedback at nemerle.org feedback at nemerle.org
Mon Nov 20 11:59:31 CET 2006


The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=790> 
======================================================================
Reported By:                akhropov
Assigned To:                malekith
======================================================================
Project:                    Nemerle
Issue ID:                   790
Category:                   Compiler
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     resolved
Resolution:                 fixed
Fixed in Version:           
======================================================================
Date Submitted:             11-16-2006 15:07 CET
Last Modified:              11-20-2006 11:59 CET
======================================================================
Summary:                    Wrong error message when trying to access nested
variant subtype
Description: 
The following code:
--------------------------------------------
using Nemerle.Utility;

variant Var
{
  | A { a : int }
  | B { v : Var2 }
}

variant Var2
{
  | A2 { a2 : int }
  | B2 { b2 : int }
}

[Record]
class Cls
{
  [Accessor] v : Var.B;
}

def x = Cls(Var.B(Var2.A2(1)));

System.Console.WriteLine( x.V.v.B2.b2 );
--------------------------------------------
produces the following compiler output:
--------------------------------------------
D:\MyProjects\Nemerle>ncc TestVariant.n
TestVariant.n:23:27:23:38:
&http://nemerle.org/bugs/view.php?id=8592;[01;31merror&http://nemerle.org/bugs/view.php?id=8592;[0m:
unbound name `V'
in `x'
--------------------------------------------
that is plain wrong because the real problem is that 'x.V.v' is not always
of type 'B2'
======================================================================

----------------------------------------------------------------------
 malekith - 11-20-06 11:28 
----------------------------------------------------------------------
Simpler example:

def s = "foo";
_ = s.Length.Foo.Bar;

->

error: unbound name `Length' in `s'



----------------------------------------------------------------------
 malekith - 11-20-06 11:59 
----------------------------------------------------------------------
Resolved in r6967.

The real problem wasn't really that v wasn't always B2, but that there is
no (instance) member named B2 in Var.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
11-16-06 15:07 akhropov       New Issue                                    
11-20-06 11:28 malekith       Note Added: 0001512                          
11-20-06 11:28 malekith       Assigned To               => malekith        
11-20-06 11:28 malekith       Status                   new => assigned     
11-20-06 11:28 malekith       Description Updated                          
11-20-06 11:59 malekith       Status                   assigned => resolved
11-20-06 11:59 malekith       Resolution               open => fixed       
11-20-06 11:59 malekith       Note Added: 0001513                          
======================================================================




More information about the bugs mailing list