Skip to content

Resolver: a bare call to a built-in links confidently to a same-named method (#3361 x #3388) #3401

Closed

Description

@squid-protocol

Part of #3265. Found while blessing #3361.

Problem

#3361 makes built-ins and stdlib calls (#3327 decision 1), so calls_out_to now lists names like map, log, printf and len. Since #3388, confident resolver edges join the dependency graph. The resolver has no idea what a built-in is. When a repository defines a function with a built-in's name, every bare call to the built-in resolves to that definition as a confident edge, even when the definition is a method or a package sub that a bare call can never reach.

Measured on language-crucible v1.4.0 (golden-master bless of #3361 on top of #3388): 41 graph-key differences per fixture beyond #3361's own 16 wrapper keys (Popularity Rank ×6, Dependency Blast Radius ×6, Composition Fit ×22, network_macro ×4, forensic lists ×3). Cases:

file definition callers Popularity Rank verdict
perl/mojo/Promise.pm sub map (a Promise method) Perl built-in map( everywhere in mojo 7 → 12 false: a bare map( in Perl is the built-in
swift/alamofire/Response.swift public func map<...> (a method on DataResponse) Swift stdlib map( 4 → 5 false: a method is only reachable through a receiver
lua/redis/printf.lua global function printf(...) bare printf( in redis scripts 0 → 3 correct: a real global redefinition
zig/zig/main.zig pub fn log( log( 1 → 3 plausibly correct

Proposal

In call_resolver.py, stop treating these as confident (scoped/unique). Label them ambiguous or external instead:

  1. Bare call to a method. An unqualified call site (no qualifier, #3265 step 2: capture the call qualifier (utils.parse, obj.save, Class::method) #3329) resolves only to a free function, never to a definition that wrapper_extractor.is_method_definition-style shape detection (or the slicer's class context) says is a method or a package sub reached through a receiver.
  2. Built-in shadowing. When the callee name is a known built-in of the caller's language and the only candidate is not a true global redefinition, do not link confidently.

Keep real global redefinitions confident: redis printf.lua's printf should still resolve.

Re-run tests/tools/call_graph_resolution.py python and call_resolution_rates.py before and after. The golden masters will move back on the Mojo/Alamofire rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions