Skip to content

Commit

Permalink
fix(go): invalid code when a module only has static methods [test onl…
Browse files Browse the repository at this point in the history
…y] (#2704)

This was already fixed by #2622. This PR introduces a test to avoid regression.

Fixes #2617
  • Loading branch information
Elad Ben-Israel authored Mar 16, 2021
1 parent 70bcd56 commit 2dbe84d
Show file tree
Hide file tree
Showing 10 changed files with 286 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/jsii-calc/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export * as submodule from './submodule';
export * as onlystatic from './only-static';
export * as nodirect from './no-direct-types';
export * as module2647 from './module2647';
export * as module2617 from './module2617';
export * as module2689 from './module2689';
export * as module2692 from './module2692';
export * as module2530 from './module2530';
11 changes: 11 additions & 0 deletions packages/jsii-calc/lib/module2617/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @see https://github.com/aws/jsii/issues/2617

export class OnlyStatics {
public static foo() {
return;
}
public static bar() {
return;
}
private constructor() {}
}
52 changes: 48 additions & 4 deletions packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,13 @@
"jsii-calc.module2530": {
"locationInModule": {
"filename": "lib/index.ts",
"line": 17
"line": 18
}
},
"jsii-calc.module2617": {
"locationInModule": {
"filename": "lib/index.ts",
"line": 15
}
},
"jsii-calc.module2647": {
Expand All @@ -226,7 +232,7 @@
"jsii-calc.module2689": {
"locationInModule": {
"filename": "lib/index.ts",
"line": 15
"line": 16
}
},
"jsii-calc.module2689.methods": {
Expand Down Expand Up @@ -256,7 +262,7 @@
"jsii-calc.module2692": {
"locationInModule": {
"filename": "lib/index.ts",
"line": 16
"line": 17
}
},
"jsii-calc.module2692.submodule1": {
Expand Down Expand Up @@ -14251,6 +14257,44 @@
"name": "MyClass",
"namespace": "module2530"
},
"jsii-calc.module2617.OnlyStatics": {
"assembly": "jsii-calc",
"docs": {
"stability": "stable"
},
"fqn": "jsii-calc.module2617.OnlyStatics",
"kind": "class",
"locationInModule": {
"filename": "lib/module2617/index.ts",
"line": 3
},
"methods": [
{
"docs": {
"stability": "stable"
},
"locationInModule": {
"filename": "lib/module2617/index.ts",
"line": 7
},
"name": "bar",
"static": true
},
{
"docs": {
"stability": "stable"
},
"locationInModule": {
"filename": "lib/module2617/index.ts",
"line": 4
},
"name": "foo",
"static": true
}
],
"name": "OnlyStatics",
"namespace": "module2617"
},
"jsii-calc.module2647.ExtendAndImplement": {
"assembly": "jsii-calc",
"base": "@scope/jsii-calc-lib.BaseFor2647",
Expand Down Expand Up @@ -15422,5 +15466,5 @@
}
},
"version": "3.20.120",
"fingerprint": "hBZRskNm0XPeSO9U+PMqKKVZ2faqmKnE9eVN2tY1Wik="
"fingerprint": "NN/7JA2G5+NzNqrZC0MowhGB3DS5OlSmsNIF8KMR7Kg="
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2dbe84d

Please sign in to comment.