diff --git a/packages/jsii-rosetta/lib/languages/go.ts b/packages/jsii-rosetta/lib/languages/go.ts index a012bd85a6..1dbb2631ff 100644 --- a/packages/jsii-rosetta/lib/languages/go.ts +++ b/packages/jsii-rosetta/lib/languages/go.ts @@ -487,13 +487,14 @@ export class GoVisitor extends DefaultVisitor { const isClassStaticMethodAccess = isStaticMember && !isClassStaticPropertyAccess && ts.isMethodDeclaration(valueSymbol.valueDeclaration); - // When the expression has an unknown type (unresolved symbol), and has an upper-case first - // letter, we assume it's a type name... In such cases, what comes after can be considered a - // static member access. Note that the expression might be further qualified, so we check using - // a regex that checks for the last "."-delimited segment if there's dots in there... + // When the expression has an unknown type (unresolved symbol), has an upper-case first letter, + // and doesn't end in a call expression (as hinted by the presence of parentheses), we assume + // it's a type name... In such cases, what comes after can be considered a static member access. + // Note that the expression might be further qualified, so we check using a regex that checks + // for the last "." - delimited segment if there's dots in there... const expressionLooksLikeTypeReference = expressionType.symbol == null && - /(?:\.|^)[A-Z][^.]*$/.exec(node.expression.getText(node.expression.getSourceFile())) != null; + /(?:\.|^)[A-Z][^.)]*$/.exec(node.expression.getText(node.expression.getSourceFile())) != null; // Whether the node is an enum member reference. const isEnumMember =