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

[SR-9617] Nested declaration becomes unknown when semicolon is attached #437

Closed
swift-ci opened this issue Jan 8, 2019 · 2 comments
Closed
Labels
bug

Comments

@swift-ci
Copy link
Contributor

@swift-ci swift-ci commented Jan 8, 2019

Previous ID SR-9617
Radar None
Original Reporter inamiy (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment
  • Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)

  • SwiftSyntax 0.40200.0

Additional Detail from JIRA
Votes 0
Component/s SwiftSyntax
Labels Bug
Assignee None
Priority Medium

md5: a81807304d8b2f0d8e94fa5de8ce131f

Issue Description:

For example, when `StructDecl`'s inner `VariableDecl` has semicolon, AST will have `UnknownDecl`.

struct Foo {
    let x = 1;
}

@rintaro
Copy link
Mannequin

@rintaro rintaro mannequin commented Jan 8, 2019

@rintaro
Copy link
Mannequin

@rintaro rintaro mannequin commented Jan 8, 2019

$ cat test.swift
struct Foo {
 let x = 1;
}
$ ../build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift -frontend -emit-syntax -verify-syntax-tree test.swift
{"id":23,"kind":"SourceFile","layout":[{"id":22,"kind":"CodeBlockItemList","layout":[{"id":20,"kind":"CodeBlockItem","layout":[{"id":19,"kind":"StructDecl","layout":[null,null,{"id":1,"tokenKind":{"kind":"kw_struct"},"leadingTrivia":[],"trailingTrivia":[{"kind":"Space","value":1}],"presence":"Present"},{"id":2,"tokenKind":{"kind":"identifier","text":"Foo"},"leadingTrivia":[],"trailingTrivia":[{"kind":"Space","value":1}],"presence":"Present"},null,null,null,{"id":18,"kind":"MemberDeclBlock","layout":[{"id":3,"tokenKind":{"kind":"l_brace"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"},{"id":16,"kind":"MemberDeclList","layout":[{"id":15,"kind":"MemberDeclListItem","layout":[{"id":13,"kind":"VariableDecl","layout":[null,null,{"id":4,"tokenKind":{"kind":"kw_let"},"leadingTrivia":[{"kind":"Newline","value":1},{"kind":"Space","value":4}],"trailingTrivia":[{"kind":"Space","value":1}],"presence":"Present"},{"id":12,"kind":"PatternBindingList","layout":[{"id":11,"kind":"PatternBinding","layout":[{"id":6,"kind":"IdentifierPattern","layout":[{"id":5,"tokenKind":{"kind":"identifier","text":"x"},"leadingTrivia":[],"trailingTrivia":[{"kind":"Space","value":1}],"presence":"Present"}],"presence":"Present"},null,{"id":10,"kind":"InitializerClause","layout":[{"id":7,"tokenKind":{"kind":"equal"},"leadingTrivia":[],"trailingTrivia":[{"kind":"Space","value":1}],"presence":"Present"},{"id":9,"kind":"IntegerLiteralExpr","layout":[{"id":8,"tokenKind":{"kind":"integer_literal","text":"1"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"}],"presence":"Present"},null,null],"presence":"Present"}],"presence":"Present"}],"presence":"Present"},{"id":14,"tokenKind":{"kind":"semi"},"leadingTrivia":[],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"}],"presence":"Present"},{"id":17,"tokenKind":{"kind":"r_brace"},"leadingTrivia":[{"kind":"Newline","value":1}],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"}],"presence":"Present"},null,null],"presence":"Present"}],"presence":"Present"},{"id":21,"tokenKind":{"kind":"eof","text":""},"leadingTrivia":[{"kind":"Newline","value":1}],"trailingTrivia":[],"presence":"Present"}],"presence":"Present"}

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug
Projects
None yet
Development

No branches or pull requests

1 participant