From f9b97fce77939739005746116ed14275728a69c7 Mon Sep 17 00:00:00 2001 From: paulklint Date: Sun, 17 Mar 2024 11:26:40 +0100 Subject: [PATCH] Ignore voidReturnIsNotAllowed for compiler First alternative of avoidEmpty causes trouble in the compiler: &T avoidEmpty(list[&T] _) { return 1; } Supposed behaviour: when called with empty list, &T is bound to void, avoidEmpty is therefore forbidden to return 1, hence this alternative fails and the next one is tried. Issue in the compiler: the return expression should depend on all type parameters of the return type. But the constant 1 does not. I do not yet see how to reconcile this with the return requirement. Probably, we should completely rewrite this test --- .../rascalmpl/library/lang/rascal/tests/basic/Generics.rsc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/rascalmpl/library/lang/rascal/tests/basic/Generics.rsc b/src/org/rascalmpl/library/lang/rascal/tests/basic/Generics.rsc index 53f01351ead..252c284402a 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/basic/Generics.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/basic/Generics.rsc @@ -49,9 +49,12 @@ bool less(&T a, &T b) = a < b; test bool lessIsConsistentThroughTypeParameters(num x, num y) = (x < y) ==> less(x, y); -&T avoidEmpty(list[&T] _) { return {&T x; 1;} } +@ignoreCompiler{How to make 1 compatible with &T?} +&T avoidEmpty(list[&T] _) { return 1; } +@ignoreCompiler{How to make 1 compatible with &T?} &T avoidEmpty(list[&T] _) { throw "this should happen"; } +@ignoreCompiler{How to make 1 compatible with &T?} test bool voidReturnIsNotAllowed() { try { avoidEmpty([]);