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 dangling doc comments in structures #1776

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,10 @@ private void parseMember(LoadOperation.DefineShape operation, Set<String> define
if (tokenizer.getCurrentToken() == IdlToken.RBRACE) {
if (memberTraits.size() == 1
&& memberTraits.get(0).getTraitType() == IdlTraitParser.TraitType.DOC_COMMENT) {
IdlTraitParser.Result danglingDocComment = memberTraits.get(0);
SourceLocation sourceLocation = danglingDocComment.getValue().getSourceLocation();
String value = danglingDocComment.getValue().toString();
emit(LoaderUtils.emitBadDocComment(sourceLocation, value));
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
[WARNING] -: Found documentation comments ('///') attached to nothing. Documentation comments must appear on their own lines, directly before shapes and members, and before any traits. The invalid comments were: Invalid 3 (before use) | Model.BadDocumentationComment
[WARNING] -: Found documentation comments ('///') attached to nothing. Documentation comments must appear on their own lines, directly before shapes and members, and before any traits. The invalid comments were: Invalid 4 (inside trait)\nInvalid 5 (not before traits)\nValid docs for Foo | Model.BadDocumentationComment
[WARNING] -: Found documentation comments ('///') attached to nothing. Documentation comments must appear on their own lines, directly before shapes and members, and before any traits. The invalid comments were: Invalid 6 (not before traits)\nInvalid 7 (inside shape line)\nInvalid 8 (dangling) | Model.BadDocumentationComment
[WARNING] -: Found documentation comments ('///') attached to nothing. Documentation comments must appear on their own lines, directly before shapes and members, and before any traits. The invalid comments were: Invalid 9 (dangling) | Model.BadDocumentationComment
[WARNING] -: Found documentation comments ('///') attached to nothing. Documentation comments must appear on their own lines, directly before shapes and members, and before any traits. The invalid comments were: Invalid 9 (not before traits)\nInvalid 10 (dangling) | Model.BadDocumentationComment
[WARNING] -: Found documentation comments ('///') attached to nothing. Documentation comments must appear on their own lines, directly before shapes and members, and before any traits. The invalid comments were: Invalid 11 (dangling) | Model.BadDocumentationComment
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,11 @@ map Foo
/// Invalid 8 (dangling)
}

/// Invalid 9 (dangling)
structure Bar {
@required
/// Invalid 9 (not before traits)
baz: Boolean
/// Invalid 10 (dangling)
}

/// Invalid 11 (dangling)