[nem-bug] [Nemerle 0000569]: list/Nil/Cons mismatch with local
generic function
feedback at nemerle.org
feedback at nemerle.org
Sun Nov 20 13:19:24 CET 2005
A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=569>
======================================================================
Reported By: malekith
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 569
Category: Compiler (type engine)
Reproducibility: always
Severity: minor
Priority: high
Status: new
======================================================================
Date Submitted: 11-12-2005 13:40 CET
Last Modified: 11-20-2005 13:19 CET
======================================================================
Summary: list/Nil/Cons mismatch with local generic function
Description:
def isSorted[Element](sequence) where Element: System.IComparable[Element]
{
| head::nextOne::tail =>
isSorted(nextOne::tail) && (head: Element).CompareTo(nextOne: Element)
!= 1
| []
| _::[] => true
}
isSorted ([1,2,3]);
======================================================================
----------------------------------------------------------------------
malekith - 11-20-05 12:10
----------------------------------------------------------------------
simpler example:
def isSorted['a](_)
{
| x1 :: x2 :: xs =>
isSorted(x2 :: xs) &&
x1.CompareTo(x2) != 1
| []
| [_] => true
}
isSorted ([1,2,3]);
this is strange, because removing ['a] makes it work
----------------------------------------------------------------------
malekith - 11-20-05 13:19
----------------------------------------------------------------------
The problem is here:
| LocalValue.Kind.Function (fun_header, _) =>
mutable sub = null;
mutable typarms = [];
def fnty =
if (fun_header.typarms.IsEmpty)
local.Type
else {
// XXX this fixes entire type, but we cannot do any
better
// I guess
(sub, typarms) = Subst.Fresh (fun_header.typarms);
sub.Apply (local.Type.Fix ())
}
_ = Expect (expected, fnty, "local function reference");
result = TExpr.LocalFunRef (expected, local, typarms);
i'm not sure if this is easy fixable....
Issue History
Date Modified Username Field Change
======================================================================
11-12-05 13:40 malekith New Issue
11-12-05 13:41 malekith Priority normal => high
11-12-05 13:41 malekith Description Updated
11-12-05 13:41 malekith Additional Information Updated
11-20-05 12:10 malekith Note Added: 0001031
11-20-05 13:19 malekith Note Added: 0001032
======================================================================
More information about the bugs
mailing list