Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby: Model more flow from splat arguments #13974

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

hmac
Copy link
Contributor

@hmac hmac commented Aug 15, 2023

  • More precise flow into splat parameters
  • Ruby: Fix SynthSplatParameterElementNode
  • Ruby: Restrict parameter nodes
  • Ruby: Remove duplicate disjuncts
  • Ruby: Add change note
  • Ruby: Remove isSplatAll arg/parameter position
  • Ruby: Handle more splat arg flow

We now precisely track flow from positional arguments to splat
parameters, provided that splat arguments are not used and there are no
positional parameters after the splat parameter. For example, in this
case:

    def f(x, y, *z); end

    f(a, b, c, d)

we get flow from `c` to `z[0]` and `d` to `z[1]`.

We get false flow if there are positional parameters after the splat
parameter. For example in this case:

    def g(x, y, *z, w); end

    g(a, b, c, d)

we get flow from `d` to `z[0]` instead of `w`.

We also track flow in this case

    def f(a, *b)
      sink b[0]
    end

    f(1, *[taint, 2])
Make this class into a proper subclass of `ParameterNodeImpl`, to
prevent some consistency test failures.
This is equivalent to isSplat(0).
Allow flow from a splat argument to a positional parameter in cases
where there are positional arguments left of the splat. For example:

    def foo(x, y, z); end

    foo(1, *[2, 3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant