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();