From a0c597c4514aa26a5eefde4ac0cd88b0836279e5 Mon Sep 17 00:00:00 2001 From: "Jurgen J. Vinju" Date: Wed, 22 Nov 2023 17:22:40 +0100 Subject: [PATCH] added a failing test for data[&T] matching against parse tree --- .../functionality/SyntaxRoleModifiers1.rsc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/org/rascalmpl/library/lang/rascal/tests/functionality/SyntaxRoleModifiers1.rsc b/src/org/rascalmpl/library/lang/rascal/tests/functionality/SyntaxRoleModifiers1.rsc index fe54ca61386..fd6d0be51a8 100644 --- a/src/org/rascalmpl/library/lang/rascal/tests/functionality/SyntaxRoleModifiers1.rsc +++ b/src/org/rascalmpl/library/lang/rascal/tests/functionality/SyntaxRoleModifiers1.rsc @@ -70,4 +70,20 @@ test bool namePreservation2() { // assignment and function return types would fail if we had a bug here. return sort("A") == typeOf(x); } - \ No newline at end of file + +test bool dataMatchesSyntaxTreesToo1() { + return data[Tree] _ := [syntax[A]] "a"; +} + +@expect{UnexpectedType} +test bool dataMatchesSyntaxTreesToo2() { + data[&T] castIt(data[&T] i) = i; + + // here &T should be bound to adt("Tree",[]) and not to sort("A"), statically. + // but I can't write a negative test for the type-checker here I think.. + + syntax[A] shoultNotAssignStatically = castIt([syntax[A]] "a"); + + // we are never supposed to end up here + return false; +} \ No newline at end of file