fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

Precondition syntax sugar results in unjustified ambiguity being reported

Open fridis opened this issue 1 year ago • 0 comments

I ran into this while experimenting with #3690: The following results in an error

 > ./build/bin/fz -e 'x ()->String := unit.as_string.substring 3; say x()' 

command line:1:32: error 1: Ambiguity between direct and partially applied call target
x ()->String := unit.as_string.substring 3; say x()

This call can be resolved in two ways, either as a direct call to 'String.precall substring' declared at $MODULE/String.fz:377:5:
    pre
      debug: 0 ≤ from ≤ byte_length

or by partially applying arguments to a call to 'String.substring' declared at $MODULE/String.fz:376:10:
  public substring(from i32) String
.
To solve this, rename one of the ambiguous features.

one error.

Apparently, a false ambiguity is reported between the artificial precondition feature String.precall substring and the original feature String.substring.

fridis avatar Sep 09 '24 09:09 fridis