Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-153

MethodExpression typecheck fails to select implementations wher argument type is subtype of formal parameter

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 1.5.2
    • 1.5.1
    • Parser/Type Checker
    • None
    • Hide

      In the specific example case, instead of calling traceStack("foo", "bar") use the equivalent call trace("bar", formatStack("foo")). In general there is no simple workaround.

      Show
      In the specific example case, instead of calling traceStack("foo", "bar") use the equivalent call trace("bar", formatStack("foo")). In general there is no simple workaround.

    Description

      When a MethodExpression is being type checked the type checker considers all overloaded version of the method as implementation candidates for the call. It prunes any candidates by iteratively comparing successive argument types with the corresponding formal types. However, it should actually ensure that the argument type is assignable to the formal type rather than equal to it.

      As an example, consider the following built-in call

      traceStack("foo", "bar").

      Helper implements two possible candidates

      traceStack(String prefix, Object key)

      and

      traceStack(String prefix, int maxFrames)

      Clearly the first one should be selected and the second one rejected. In fact, neither is accepted.

      Attachments

        Activity

          People

            rhn-engineering-adinn Andrew Dinn
            rhn-engineering-adinn Andrew Dinn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: