Skip to content

Conversation

@SuperUserDone
Copy link
Contributor

No description provided.

@SuperUserDone SuperUserDone requested a review from ml86 January 21, 2026 14:01
|""".stripMargin)

inside(cpg.call.name("filter").argument.l) { case List(receiver, methodRef: MethodRef) =>
methodRef.methodFullName shouldBe "<unresolvedNamespace>.isOdd:boolean(int)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does isOdd really have <unresolvedNamespace>.isOdd:boolean(int) as method full name? If yes that is already a problem, if not the methodRef should use the same method full name as the referenced method.

val methodRef = methodRefs.head

// The exact type will depend on Kotlin stdlib resolution
methodRef.methodFullName should include("forEach")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forEach is not a full name. I would have expected something like e.g. kotlin.collection.forEach(...).

Comment on lines +26 to +27
inside(cpg.call.name("doNothing").argument.l) { case List(thisArg: Identifier, methodRef: MethodRef) =>
thisArg.name shouldBe "this"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing for this argument does not really belong to the thing we want to check here. Please remove it.

thisArg.name shouldBe "this"

methodRef.methodFullName shouldBe "com.test.Bar.bar:void(int)"
methodRef.typeFullName shouldBe "com.test.Bar"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. You seem to have looked at Javasrc2cpg, but that is/was sadly not a good example and Johannes is fixing it there as we speak.

You basically have to create a new synthetic TYPE_DECL and a corresponding TYPE which is then referenced here in typeFullName. This new TYPE_DECL then needs bindings that reflect the implemented interface.

I suggest you and @johannescoetzee talk tomorrow so that he can tell you the details.
One pointer where most of this is already implemented and tested are the Lambda function tests in Javasrc2cpg here

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants