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-7060] libSyntax missing ImportDecl in nightly snapshots #49608

Closed
keith opened this issue Feb 22, 2018 · 2 comments
Closed

[SR-7060] libSyntax missing ImportDecl in nightly snapshots #49608

keith opened this issue Feb 22, 2018 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself import Feature → declarations: `import` declarations † libswiftSyntax † Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax source tooling Area: IDE support, SourceKit, and other source tooling swift 4.1 unexpected behavior Bug: Unexpected behavior or incorrect output

Comments

@keith
Copy link
Collaborator

keith commented Feb 22, 2018

Previous ID SR-7060
Radar None
Original Reporter @keith
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Bug, Syntax
Assignee None
Priority Medium

md5: 24c84b6fd63fb48950e0b1bf90b9e3ae

Issue Description:

If you download a swift snapshot (I've tried 1/10, 1/15, 2/1, and 2/21 for this) and attempt to get the syntax of this file:

import Foundation

Using:

/Library/Developer/Toolchains/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-02-21-a.xctoolchain/usr/bin/swiftc -frontend -emit-syntax test.swift

You end up with this result:

{
  "kind": "SourceFile",
  "layout": [
    {
      "kind": "DeclList",
      "layout": [
        {
          "kind": "TopLevelCodeDecl",
          "layout": [
            {
              "kind": "StmtList",
              "layout": [
                {
                  "kind": "DeclarationStmt",
                  "layout": [
                    {
                      "kind": "UnknownDecl",
                      "layout": [
                        {
                          "tokenKind": {
                            "kind": "kw_import"
                          },
                          "leadingTrivia": [

                          ],
                          "trailingTrivia": [
                            {
                              "kind": "Space",
                              "value": 1
                            }
                          ],
                          "presence": "Present"
                        },
                        {
                          "tokenKind": {
                            "kind": "identifier",
                            "text": "Foundation"
                          },
                          "leadingTrivia": [

                          ],
                          "trailingTrivia": [

                          ],
                          "presence": "Present"
                        }
                      ],
                      "presence": "Present"
                    },
                    {
                      "tokenKind": {
                        "kind": "semi"
                      },
                      "leadingTrivia": [

                      ],
                      "trailingTrivia": [

                      ],
                      "presence": "Missing"
                    }
                  ],
                  "presence": "Present"
                }
              ],
              "presence": "Present"
            }
          ],
          "presence": "Present"
        }
      ],
      "presence": "Present"
    },
    {
      "tokenKind": {
        "kind": "eof"
      },
      "leadingTrivia": [
        {
          "kind": "Newline",
          "value": 1
        }
      ],
      "trailingTrivia": [

      ],
      "presence": "Present"
    }
  ],
  "presence": "Present"
}

Note the UnknownDecl where there should be an ImportDecl

I built Swift locally and ended up getting the ImportDecl correctly here.

@belkadan
Copy link
Contributor

cc @nkcsgexi

@nkcsgexi
Copy link
Member

@keith could you use master toolchain instead? 4.1 branch is way behind.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added source tooling Area: IDE support, SourceKit, and other source tooling unexpected behavior Bug: Unexpected behavior or incorrect output import Feature → declarations: `import` declarations swift 4.1 labels Apr 5, 2023
@AnthonyLatsis AnthonyLatsis added the compiler The Swift compiler in itself label Apr 5, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself import Feature → declarations: `import` declarations † libswiftSyntax † Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax source tooling Area: IDE support, SourceKit, and other source tooling swift 4.1 unexpected behavior Bug: Unexpected behavior or incorrect output
Projects
None yet
Development

No branches or pull requests

4 participants