[nem-bug] [Nemerle 0000652]: Generic parameter names can't be used
inside quoted declaration
feedback at nemerle.org
feedback at nemerle.org
Wed Apr 12 20:52:47 CEST 2006
The following issue has been RESOLVED.
======================================================================
<http://nemerle.org/bugs/view.php?id=652>
======================================================================
Reported By: OysterDva
Assigned To: nazgul
======================================================================
Project: Nemerle
Issue ID: 652
Category: Compiler (parser/macros engine)
Reproducibility: always
Severity: minor
Priority: normal
Status: resolved
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 04-08-2006 11:49 CEST
Last Modified: 04-12-2006 20:52 CEST
======================================================================
Summary: Generic parameter names can't be used inside quoted
declaration
Description:
Here is the macro which defines new generic type:
macro TestMacro()
{
def t = Nemerle.Macros.ImplicitCTX().Env.Define(<[ decl:
public class TestClass['a]
{
public this(value : 'a) {}
}
]>);
t.Compile();
<[ TestClass() ]>
}
If I'm trying to use ths macro then compilation fails. Error message is
the following: "error : unbound type name `'a'".
Without constructor (which has parameter of type 'a - generic parameter
name) everything works like a charm.
======================================================================
----------------------------------------------------------------------
OysterDva - 04-10-06 06:55
----------------------------------------------------------------------
Guys, can you provide at least some workaround for this problem?
----------------------------------------------------------------------
nazgul - 04-10-06 08:39
----------------------------------------------------------------------
It is probably some bug in hygienic names creation - you can try to
workaround it by using $("a" : dyn) for declaration and/or uses of
parameter.
I will look into it in a few days.
----------------------------------------------------------------------
OysterDva - 04-10-06 09:17
----------------------------------------------------------------------
Thank you for the workaround - it works. The only note - you need to
provide type parameter "as is" in declaration so the following code will
compile and work:
macro TestMacro()
{
def t = Nemerle.Macros.ImplicitCTX().Env.Define(<[ decl:
public class TestClass['a]
{
public this(value : $("'a" : dyn)) {}
}
]>);
t.Compile();
<[ TestClass() ]>
}
And the following won't:
macro TestMacro()
{
def t = Nemerle.Macros.ImplicitCTX().Env.Define(<[ decl:
public class TestClass[$("'a" : dyn)]
{
public this(value : $("'a" : dyn)) {}
}
]>);
t.Compile();
<[ TestClass() ]>
}
The compile-time error in the second case is the following: "parse error
near operator `$': expecting type variable".
----------------------------------------------------------------------
nazgul - 04-11-06 22:01
----------------------------------------------------------------------
Fixed on trunk (r6191).
----------------------------------------------------------------------
OysterDva - 04-12-06 07:34
----------------------------------------------------------------------
Now this test case won't compile:
public interface IFoo {}
macro TestMacro()
{
def t = Nemerle.Macros.ImplicitCTX().Env.Define(<[ decl:
public class TestClass['a] where 'a : IFoo
{
public this(value : 'a) {}
}
]>);
t.Compile();
<[ TestClass() ]>
}
The compiler error message is: "unbound type variable `'a' in constraint".
----------------------------------------------------------------------
nazgul - 04-12-06 20:52
----------------------------------------------------------------------
New testcase fixed on trunk (r6192). :)
Issue History
Date Modified Username Field Change
======================================================================
04-08-06 11:49 OysterDva New Issue
04-10-06 06:55 OysterDva Note Added: 0001183
04-10-06 08:39 nazgul Note Added: 0001184
04-10-06 09:17 OysterDva Note Added: 0001185
04-11-06 22:01 nazgul Status new => resolved
04-11-06 22:01 nazgul Resolution open => fixed
04-11-06 22:01 nazgul Assigned To => nazgul
04-11-06 22:01 nazgul Note Added: 0001190
04-11-06 22:01 nazgul Summary Generic parameter names
can't be used inside quoted declaration => Generic parameter names can\'t be
used inside quoted declaration
04-11-06 22:01 nazgul Description Updated
04-12-06 07:34 OysterDva Status resolved => feedback
04-12-06 07:34 OysterDva Resolution fixed => reopened
04-12-06 07:34 OysterDva Note Added: 0001191
04-12-06 07:34 OysterDva Summary Generic parameter names
can't be used inside quoted declaration => Generic parameter names can\'t be
used inside quoted declaration
04-12-06 07:34 OysterDva Description Updated
04-12-06 20:52 nazgul Status feedback => resolved
04-12-06 20:52 nazgul Resolution reopened => fixed
04-12-06 20:52 nazgul Note Added: 0001192
======================================================================
More information about the bugs
mailing list