From 5cee573baf4e30c27a173419cf724e655c315624 Mon Sep 17 00:00:00 2001 From: Mick Cooney Date: Thu, 22 Oct 2026 18:22:33 +0100 Subject: [PATCH] fix(r): strip backticks from R6 class name when typing $new() receivers The R grammar yields an identifier whose text keeps its backticks, so `Foo`$new() produced calleeName "`Foo`" while the class-name set holds the bare name. Apply rBareName, as declaredClassName already does. Found in bot review round 5 (PR #3513, comment 4348423277). --- gitnexus/src/core/ingestion/type-extractors/r.ts | 2 +- gitnexus/test/unit/r-assignment-operator.test.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gitnexus/src/core/ingestion/type-extractors/r.ts b/gitnexus/src/core/ingestion/type-extractors/r.ts index ba7636a998..e3f84d7080 100644 --- a/gitnexus/src/core/ingestion/type-extractors/r.ts +++ b/gitnexus/src/core/ingestion/type-extractors/r.ts @@ -273,7 +273,7 @@ const scanConstructorBinding: ConstructorBindingScanner = (node) => { const className = children[0]; const method = children[1]; if (className?.type === 'identifier' && method?.text === 'new') { - return { varName: lhs.text, calleeName: className.text }; + return { varName: lhs.text, calleeName: rBareName(className.text) }; } } } diff --git a/gitnexus/test/unit/r-assignment-operator.test.ts b/gitnexus/test/unit/r-assignment-operator.test.ts index 244d8ec35f..5639dca033 100644 --- a/gitnexus/test/unit/r-assignment-operator.test.ts +++ b/gitnexus/test/unit/r-assignment-operator.test.ts @@ -185,6 +185,13 @@ describe('R type environment: only an assignment binds a type', () => { }); }); + it('scans a backticked R6 class name as the bare class name', () => { + expect(constructorBinding('obj <- `Foo`$new()')).toEqual({ + varName: 'obj', + calleeName: 'Foo', + }); + }); + it.each(['+', '==', '->'])('scans nothing for `obj %s Foo$new()`', (op) => { expect(constructorBinding(`obj ${op} Foo$new()`)).toBeUndefined(); expect(constructorBinding(`obj ${op} new("Foo")`)).toBeUndefined();