STR-199: Dynrules: matching of static patterns is not always modulo annos
Only in some very specific cases. Testsuite:
module foo
imports
sunitstrategies
main =
test-suite(!“Annotations in static patterns”,
annos-in-static-patterns
)annos-in-static-patterns =
rules(Foo : (1, x) -> x); rules(Fred : Some(x) -> x) ; rules(Fred : None() -> ()) ; rules(Bar : 1 -> ()) ; apply-test(!"No annotions" , Foo , !(1, 2) , !3 ) ; apply-test(!"Annotion in first element" , Foo , !(1{"anno"}, 2) , !3 ) ; apply-test(!"No annotion in first element" , Foo , !(1{}, 2) , !3 ) ; apply-test(!"Anno of tuple" , Foo , !(1, 2){"anno"} , !3 ) ; apply-test(!"Anno of second element" , Foo , !(1, 2{"Foo"}){"anno"} , !3 ) ; apply-test(!"Anno of int" , Bar , !1{2} , !() ) ; apply-test(!"Anno of Some" , Fred , !Some(7){2} , !7 ) ; apply-test(!"Anno of None" , Fred , !None(){2} , !() )
martin@logistico:~> ./foo
test suite: Annotations in static patterns
No annotions
Annotion in first element
No annotion in first element
Anno of tuple
Anno of second element
Anno of int
failed
Anno of Some
Anno of None
failed
successes: 6
failures: 2
./foo: rewriting failed
——————————————————Notice that only annos on the top-level term and then even in some speicfic cases are not supported.
Submitted on 31 October 2004 at 19:56
Issue Log
STR-199, martin:
The top-level annos should not just be removed: this depends on the actual static pattern. If it has annos, then the annos should not be removed.; apply-test(!"Anno of tuple" , Barney , !(1, 3){"Anno"} , !3 ) ; apply-and-fail(!"Anno of tuple" , Barney , !(1, 3) )
STR-199, visser:
This issue has been solved as part of the 0.15 refactoring.
Log in to post comments