Skip to content

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

@molenzwiebel

Description

@molenzwiebel

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)).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions