Comparing development...fix/call-arg-errors-patch1 · HaxeFoundation/haxe · GitHub
Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: HaxeFoundation/haxe
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: development
Choose a base ref
...
head repository: HaxeFoundation/haxe
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fix/call-arg-errors-patch1
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 13 commits
  • 88 files changed
  • 1 contributor

Commits on Jun 8, 2026

  1. Configuration menu
    Copy the full SHA
    fe5d4d8 View commit details
    Browse the repository at this point in the history
  2. [tests] add tests for diagnostics false positives with function args (#…

    …10634, #7924)
    
    Server test for #7924 (optional arg skipping + unqualified enum value), and
    misc compile-fail tests covering error reporting for failures inside a function
    literal that is passed as a call argument.
    kLabz committed Jun 8, 2026
    Configuration menu
    Copy the full SHA
    cf6e345 View commit details
    Browse the repository at this point in the history
  3. [tests] add tests for call-argument / function-body error reporting

    Documents several error-reporting issues when a call argument (often a function
    literal) fails to type. The .stderr files hold the expected (correct) output, so
    the still-broken cases are red until fixed and the fixed cases stay green.
    
    Failing (known issues, expected output is the tentative correct one):
    - Swallow: a real error that is a side effect of typing an argument (module load)
      is silently dropped when the argument is skipped to a later optional parameter.
    - Cascade*: a block-bodied function literal with an inner error reports the real
      error plus a spurious "Void should be Int" unification error (array/var/return
      variants reproduce on development; the call-argument variant on this branch).
    - MaskStruct*: when an argument is skipped past an earlier optional and then fails
      against the intended one, only the first (irrelevant) mismatch is reported,
      hiding the real "Object requires field y". Reproduces on development.
    
    Passing (guard behavior fixed on this branch):
    - MaskBody*: a non-return unification error inside the body, fully masked on
      development, is now reported with the real "String should be Int".
    - DuplicateReport: an error reported twice on development (skip + re-type) is now
      reported once.
    
    See #5837, #10634.
    kLabz committed Jun 8, 2026
    Configuration menu
    Copy the full SHA
    19810bd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    93d17c3 View commit details
    Browse the repository at this point in the history
  5. [typer] report function-body / call-argument errors at their own posi…

    …tion (#10634, #7924)
    
    When typing a call argument, errors that occur inside the body of a function
    literal were attributed to the enclosing call argument ("For function argument
    'x'"), and in diagnostics mode an unresolved identifier produced a false
    positive instead of letting optional-argument skipping / overload resolution
    recover. Four related changes fix this:
    
    - type_local_function resets in_call_args while typing the body, so body errors
      are reported in place instead of being re-raised and wrapped by arg_error
      (kept during overload resolution, where a body error must reject the candidate).
    - type_block recovers a failed value-position expression as a fresh monomorph
      instead of dropping it to Void, avoiding a spurious cascade ("Void should be
      Int") against the expected type.
    - type_ident raises for an unresolved identifier while in_call_args even in
      diagnostics mode, so the skip / overload machinery can recover (no false positive).
    - unify_call_args rolls back the function-literal body errors of an argument that
      is skipped to a later parameter (re-emitted when it binds), so they are not
      reported twice, while preserving once-only side-effect errors (e.g. module load).
    kLabz committed Jun 8, 2026
    Configuration menu
    Copy the full SHA
    a81eb53 View commit details
    Browse the repository at this point in the history
  6. [typer] recover expression-body errors in function-literal call argum…

    …ents (#12934)
    
    A block-bodied function literal recovers body errors per-statement inside
    type_block, but an expression body (e.g. `() -> x` / `function() x`) let the
    error propagate out of type_function. When the function literal is a call
    argument, that propagated error was caught as a signature failure, which then
    reported a stale skipped-argument error and masked the real one:
    
      foo(0, TInt, function() x)  // wrongly: "Unknown identifier : TInt" for ?v
    
    Now a call-argument function literal recovers its body error in place (committed
    while in_call_args is reset), so the argument binds normally and the real error
    is reported at its own position (here the unresolved `x`), letting `TInt` resolve
    against the later Type.ValueType parameter.
    kLabz committed Jun 8, 2026
    Configuration menu
    Copy the full SHA
    659f86d View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    92a1f71 View commit details
    Browse the repository at this point in the history
  8. [typer] harden call-arg body-message tracking; add multi/nested funct…

    …ion-literal tests
    
    Record the rollback set as the message prefix newer than messages_before, bailing
    out if that boundary is no longer a tail (a nested call may have rolled messages
    back via List.filter) so we never roll back unrelated messages.
    
    Tests cover multiple function-literal arguments and a nested skipping call:
    - MultiBind: two function-literal args, both bodies error -> both reported in place.
    - NestedSkip: a function-literal body containing a skipping call whose argument
      body errors -> each error reported once, in place.
    - MultiNoSkip: no skip room, the first function literal cannot fit ?n:Int.
    kLabz committed Jun 8, 2026
    Configuration menu
    Copy the full SHA
    a77e577 View commit details
    Browse the repository at this point in the history
  9. [typer] suppress impossible function-vs-non-function signature error …

    …after a body error
    
    When a function literal whose body already reported error(s) in place is passed to
    a non-function parameter (e.g. `() -> err` against `?n:Int`), it can never fit, so
    the trailing signature mismatch is pure noise. Suppress it and recover (default the
    parameter) so later arguments are still checked. A function-vs-function mismatch is
    a real signature error and is kept (see SignatureKept).
    
    Updates MultiNoSkip (now reports both body errors) and adds SignatureKept.
    kLabz committed Jun 8, 2026
    Configuration menu
    Copy the full SHA
    5ead789 View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2026

  1. [tests] Add test for #12910 too

    kLabz committed Jun 9, 2026
    Configuration menu
    Copy the full SHA
    8c47d3c View commit details
    Browse the repository at this point in the history
  2. [typer] group call-arg resolution state into call_arg_context

    Replace g.call_arg_body_messages and f.in_overload_call_args with a single
    g.call_arg_context option, Some only while unify_call_args resolves a call.
    Both moved fields share that exact lifetime, so the manual save/restore and
    cross-file raw mutation collapse into enter_call_args plus a few accessors.
    
    in_call_args stays a separate bool: it is additionally toggled off while
    typing function-literal bodies and display sub-expressions, a finer lifetime
    than the call_arg_context. delayed_display is left untouched.
    kLabz committed Jun 9, 2026
    Configuration menu
    Copy the full SHA
    d4c6f74 View commit details
    Browse the repository at this point in the history
  3. [tests] Add test for #5522

    kLabz committed Jun 9, 2026
    Configuration menu
    Copy the full SHA
    214cf82 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1d0e888 View commit details
    Browse the repository at this point in the history
Loading