Skip to content

Java implemented functions don't pattern-based dispatch (interpreter) #2758

@tvdstorm

Description

@tvdstorm

If function is implemented in Java (with the java keyword), dispatch is not performed on the run-time type of the actual arguments, but their declared type must match the type of the formal parameters.

Reproduce:

module Bug

import lang::json::IO;

void bug() {    
    value x = "{}";
    parseJSON(#value, x);
}

This gives a CallFailed exception:

|.../src/main/rascal/Bug.rsc|(103,1,<11,22>,<11,23>): CallFailed([type(
      value(),
      ()),"{}"])
        at bug(|.../src/main/rascal/Bug.rsc|(85,21,<11,4>,<11,25>))
        at $(|prompt:///|(0,11,<1,0>,<1,11>))

The exception does not happen when x is declared as str.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions