usage of call.argument without any parameter leads to compiler error
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the compiler error with the Scala snippet and inspect the CallMethods.argument API together with the shown EdgeTypes.ARGUMENT workaround. Confirm that the intended argument-count expression compiles and returns the same count without requiring an explicit parameter.
Written by the indexing model from the issue text.
Description
cpg.call.codeExact("...").head match {
case (call : nodes.Call) :: Nil =>
println(call.argument.l.length)
}
leads to compiler error:
missing argument list for method argument in class CallMethods
[error] Unapplied methods are only converted to functions when a function type is expected.
[error] You can make this conversion explicit by writing `argument _` or `argument(_)` instead of `argument`.
When applying the suggested fix:
cpg.call.codeExact("...").head match {
case (call : nodes.Call) :: Nil =>
println(call.argument(_).l.length)
}
I get the compiler error:
missing parameter type for expanded function ((<x$1: error>) => call.argument(x$1).l.length.shouldBe(1))
[error] println(call.argument(_).l.length)
[error]
I was expecting to simply print the amount of arguments connected to that call node.
Current work-around:
cpg.call.codeExact("...").head match {
case (call : nodes.Call) :: Nil =>
println(call.out(EdgeTypes.ARGUMENT).asScala.toList.length)
}
I am using cpg version: 1.2.25
- Dominant language
- Scala
- Stars
- 599
- Forks
- 84
- Avg merge
- 18h 29m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ShiftLeftSecurity/codepropertygraph
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
ShiftLeftSecurity/codepropertygraph#1760 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ShiftLeftSecurity/codepropertygraph#1272 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
ShiftLeftSecurity/codepropertygraph#1082 · 1 comment ·
All issues in ShiftLeftSecurity/codepropertygraph
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ergoplatform/ergodocs#614 ·
-
area:ci enhancement requires-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/datafusion-comet#6078 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug delta-datalayout flink
Difficulty 2/5 1-3 hours Newbie friendliness 86/100