Uploaded image for project: 'Swift'
  1. Swift
  2. SR-7954

SourceKit crashes with "Assertion `shouldCollectToken() && "Disabled"' failed." when "key.name" is negative integer string

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Source Tooling
    • Labels:
      None
    • Environment:

      ubuntu 16.04
      swift-4.2-DEVELOPMENT-SNAPSHOT-2018-06-08-a

      Description

      Reproducing steps:

      1. docker run --privileged -it --rm norionomura/swift:swift-4.2-branch
      2. git clone https://github.com/jpsim/SourceKitten.git
      3. cd SourceKitten/
      4. swift build
      5. .build/debug/sourcekitten request --yaml '
        key.request: source.request.editor.open
        key.name: "-1"
        key.sourcetext: "let a = 1"
        '

      logs:

      $ docker run --privileged -it --rm norionomura/swift:swift-4.2-branch
      root@e4a20490bb53:/# git clone https://github.com/jpsim/SourceKitten.git
      Cloning into 'SourceKitten'...
      remote: Counting objects: 10013, done.
      remote: Compressing objects: 100% (148/148), done.
      remote: Total 10013 (delta 117), reused 170 (delta 89), pack-reused 9772
      Receiving objects: 100% (10013/10013), 7.66 MiB | 990.00 KiB/s, done.
      Resolving deltas: 100% (6415/6415), done.
      Checking connectivity... done.
      root@e4a20490bb53:/# cd SourceKitten/
      root@e4a20490bb53:/SourceKitten# swift build
      Fetching https://github.com/norio-nomura/Clang_C.git
      Fetching https://github.com/Quick/Quick.git
      Fetching https://github.com/Carthage/Commandant.git
      Fetching https://github.com/jpsim/Yams.git
      Fetching https://github.com/antitypical/Result.git
      Fetching https://github.com/norio-nomura/SourceKit.git
      Fetching https://github.com/drmohundro/SWXMLHash.git
      Fetching https://github.com/Quick/Nimble.git
      Completed resolution in 8.87s
      Cloning https://github.com/Quick/Nimble.git
      Resolving https://github.com/Quick/Nimble.git at 7.1.1
      Cloning https://github.com/norio-nomura/Clang_C.git
      Resolving https://github.com/norio-nomura/Clang_C.git at 1.0.3
      Cloning https://github.com/jpsim/Yams.git
      Resolving https://github.com/jpsim/Yams.git at 1.0.0
      Cloning https://github.com/Carthage/Commandant.git
      Resolving https://github.com/Carthage/Commandant.git at 0.13.0
      Cloning https://github.com/antitypical/Result.git
      Resolving https://github.com/antitypical/Result.git at 3.2.4
      Cloning https://github.com/drmohundro/SWXMLHash.git
      Resolving https://github.com/drmohundro/SWXMLHash.git at 4.7.0
      Cloning https://github.com/Quick/Quick.git
      Resolving https://github.com/Quick/Quick.git at 1.3.0
      Cloning https://github.com/norio-nomura/SourceKit.git
      Resolving https://github.com/norio-nomura/SourceKit.git at 1.0.1
      Compile CYaml src/writer.c
      Compile Swift Module 'SWXMLHash' (3 sources)
      /SourceKitten/.build/checkouts/SWXMLHash.git--8537495678296207061/Source/SWXMLHash.swift:430:33: warning: conditional cast from 'Error' to 'NSError' always succeeds
              if let err = parseError as? NSError {
                                      ^
      Compile Swift Module 'Result' (2 sources)
      Compile CYaml src/scanner.c
      Compile Swift Module 'Commandant' (9 sources)
      Compile CYaml src/reader.c
      Compile CYaml src/parser.c
      Compile CYaml src/emitter.c
      Compile CYaml src/api.c
      Compile Swift Module 'Yams' (16 sources)
      Compile Swift Module 'SourceKittenFramework' (37 sources)
      Compile Swift Module 'sourcekitten' (11 sources)
      Linking ./.build/x86_64-unknown-linux/debug/sourcekitten
      root@e4a20490bb53:/SourceKitten# .build/debug/sourcekitten request --yaml '
      key.request: source.request.editor.open
      key.name: "-1"
      key.sourcetext: "let a = 1"
      '
      Could not read contents of `
      key.request: source.request.editor.open
      key.name: "-1"
      key.sourcetext: "let a = 1"
      `
      sourcekitten: /home/buildnode/jenkins/workspace/oss-swift-4.2-package-linux-ubuntu-16_04/swift/lib/AST/Module.cpp:1372: ArrayRef<swift::Token> swift::SourceFile::getAllTokens() const: Assertion `shouldCollectToken() && "Disabled"' failed.
      Aborted
      root@e4a20490bb53:/SourceKitten# 
      

      SeeAlso: https://github.com/jpsim/SourceKitten/issues/529

        Attachments

          Activity

            People

            • Assignee:
              rintaro Rintaro Ishizaki
              Reporter:
              norio_nomura Norio Nomura
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: