Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map(try(s)) does not report a cast inserted for s #27

Open
molenzwiebel opened this issue Dec 17, 2021 · 0 comments
Open

map(try(s)) does not report a cast inserted for s #27

molenzwiebel opened this issue Dec 17, 2021 · 0 comments
Assignees
Labels
Prio-Medium Medium priority Project-Stratego2-Lang Stratego 2 language project State-Open Type-Bug

Comments

@molenzwiebel
Copy link

Describe the bug
Using map(try(s)) for some strategy s will not report a cast insertion, even if there is a cast inserted. This is unlike filter(s), which seems to behave differently and may not even insert a cast.

Project
Used inside a Spoofax 3 source project.

Versions
metaborg/devenv@fe13745

To Reproduce

signature
  sorts Test
  constructors
    Foo : Test
    Bar : Test
    
rules
  run = ![Foo(), Bar()]; issue
  
  issue :: List(Test) -> ?
  issue = map(try(do-something-with-bar)) // fails, no cast message
  // issue = filter(do-something-with-bar) // succeeds, no cast message (and seemingly no cast needed)
  
  do-something-with-bar: Bar() -> ()
    with debug(!"Got a bar: ")

Observed behaviour

Exception during evaluation: Cannot cast the following term from Tuple to Test:
()

Expected behaviour
Ideally, this succeeds as this is perfectly fine in Stratego 1. If that is not possible, a message that a cast is being inserted in the map(try(s)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio-Medium Medium priority Project-Stratego2-Lang Stratego 2 language project State-Open Type-Bug
Projects
None yet
Development

No branches or pull requests

2 participants