Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(go): malformed multiline docstrings in constructors #2639

Merged
merged 5 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/jsii-calc/lib/compliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2925,3 +2925,22 @@ export class TestStructWithEnum {
};
}
}

/**
* Docstrings with period
* @see https://github.com/aws/jsii/issues/2638
*/
export class Issue2638 {
/**
* First sentence. Second sentence. Third sentence.
*/
public constructor() {
return;
}
}

export class Issue2638B {
public constructor() {
return; // no docs
}
}
50 changes: 49 additions & 1 deletion packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -7219,6 +7219,54 @@
],
"name": "Isomorphism"
},
"jsii-calc.Issue2638": {
"assembly": "jsii-calc",
"docs": {
"see": "https://github.com/aws/jsii/issues/2638",
"stability": "stable",
"summary": "Docstrings with period."
},
"fqn": "jsii-calc.Issue2638",
"initializer": {
"docs": {
"remarks": "Second sentence. Third sentence.",
"stability": "stable",
"summary": "First sentence."
},
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 2937
}
},
"kind": "class",
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 2933
},
"name": "Issue2638"
},
"jsii-calc.Issue2638B": {
"assembly": "jsii-calc",
"docs": {
"stability": "stable"
},
"fqn": "jsii-calc.Issue2638B",
"initializer": {
"docs": {
"stability": "stable"
},
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 2943
}
},
"kind": "class",
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 2942
},
"name": "Issue2638B"
},
"jsii-calc.JSII417Derived": {
"assembly": "jsii-calc",
"base": "jsii-calc.JSII417PublicBaseOfBase",
Expand Down Expand Up @@ -14756,5 +14804,5 @@
}
},
"version": "3.20.120",
"fingerprint": "GfueSeyZdyEIZp4V4lbddw+TnoCel74KSDMPxp2phmw="
"fingerprint": "WnxyYDpN1opFu5dYMKwKeo5wN3IkNe9gnovO0ro7i2U="
}
7 changes: 1 addition & 6 deletions packages/jsii-pacmak/lib/targets/go/types/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,7 @@ export class GoClassConstructor {
? ''
: this.parameters.map((p) => p.toString()).join(', ');

let docstring = '';
if (this.type.docs.summary) {
docstring = this.type.docs.toString();
code.line(`// ${docstring}`);
}

context.documenter.emit(this.type.docs);
code.openBlock(`func ${constr}(${paramString}) ${this.parent.name}`);

this.constructorRuntimeCall.emit(code);
Expand Down

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