Menu ▾ ▴

#173 nicec creates infinitly recursive program

open
nobody
None
5
2006-06-21
2006-06-21
B S
No

When looking at bug 1483583, I found that this program
gives a StackOverflowError when ran:

package testing;
import nice.functional;
<T> Slice<T> sliceRange(Range<T> range) = range;
override <T> List<T> get(List<T> list, Range<int>
range) = list[sliceRange(range)];

interface Term<T> {
T value();
}

interface Int implements Term<int> {}

class VInt implements Int{
value() = 1;
}

void main(String[] args)
{
List<int> list = [1,2,3,4,5,6];
println(list[3..4]);
Int a = new VInt();
var b = a.value();
}

Error:
Exception in thread "main" java.lang.StackOverflowError
at testing.fun.get(Unknown Source)
at nice.functional.dispatch.get(Unknown Source)
at testing.fun.get(Unknown Source)
at nice.functional.dispatch.get(Unknown Source)
at testing.fun.get(Unknown Source)
at nice.functional.dispatch.get(Unknown Source)
...

For some reason, removing any of the stuff in main
fixes the problem.

Discussion


Log in to post a comment.