Giter Club home page Giter Club logo

Comments (8)

AnthonyLatsis avatar AnthonyLatsis commented on September 2, 2024

Shorter — swiftc -emit-module -enable-batch-mode Dupe.swift where Dupe.swift contains anything that must not parse, e.g. let. The culprit is -enable-batch-mode and the duplication does not reproduce with the old driver.

@hamishknight Please see to the transfer.

from swift-driver.

hamishknight avatar hamishknight commented on September 2, 2024

Interesting, we appear to be creating two -emit-module jobs, one of them seems like an intermediate output that would have previously been used for merge-modules (or I guess maybe it's still required to ensure we type-check function bodies?):

❯ ./swiftc -emit-module -enable-batch-mode ~/src/swift-test-arena/swift-test-arena/main.swift -###
/Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-frontend -frontend -emit-module -primary-file /Users/hamish/src/swift-test-arena/swift-test-arena/main.swift -target x86_64-apple-macosx13.0 -warn-on-potentially-unavailable-enum-case -enable-objc-interop -color-diagnostics -new-driver-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift -module-name main -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift/host/plugins -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/local/lib/swift/host/plugins -o /var/folders/3m/l5fbv4dn6wz112cw2nhjq69h0000gn/T/TemporaryDirectory.jKvDlg/main-2.swiftmodule
/Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /Users/hamish/src/swift-test-arena/swift-test-arena/main.swift -target x86_64-apple-macosx13.0 -warn-on-potentially-unavailable-enum-case -enable-objc-interop -color-diagnostics -new-driver-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift -module-name main -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift/host/plugins -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/local/lib/swift/host/plugins -emit-module-doc-path main.swiftdoc -emit-module-source-info-path main.swiftsourceinfo -o main.swiftmodule -emit-abi-descriptor-path main.abi.json
❯ ./swiftc -enable-batch-mode -emit-module ~/src/swift-test-arena/swift-test-arena/main.swift -v
Swift version 5.9-dev (LLVM dcb09f599ae5aa9, Swift edc003ac9278d7c)
Target: x86_64-apple-macosx13.0
/Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-frontend -frontend -emit-module -primary-file /Users/hamish/src/swift-test-arena/swift-test-arena/main.swift -target x86_64-apple-macosx13.0 -warn-on-potentially-unavailable-enum-case -enable-objc-interop -color-diagnostics -new-driver-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift -module-name main -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift/host/plugins -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/local/lib/swift/host/plugins -o /var/folders/3m/l5fbv4dn6wz112cw2nhjq69h0000gn/T/TemporaryDirectory.lfL6bi/main-2.swiftmodule
/Users/hamish/src/swift-test-arena/swift-test-arena/main.swift:2365:4: error: expected pattern
var
   ^
/Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /Users/hamish/src/swift-test-arena/swift-test-arena/main.swift -target x86_64-apple-macosx13.0 -warn-on-potentially-unavailable-enum-case -enable-objc-interop -color-diagnostics -new-driver-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift -module-name main -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift/host/plugins -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/local/lib/swift/host/plugins -emit-module-doc-path main.swiftdoc -emit-module-source-info-path main.swiftsourceinfo -o main.swiftmodule -emit-abi-descriptor-path main.abi.json
error: emit-module command failed with exit code 1 (use -v to see invocation)
/Users/hamish/src/swift-test-arena/swift-test-arena/main.swift:2365:4: error: expected pattern
var
   ^
error: fatalError

Without -enable-batch-mode, we appear to do the same thing, but the jobs are the other way around, and we appear to bail after the first failure:

❯ ./swiftc -emit-module ~/src/swift-test-arena/swift-test-arena/main.swift -###
/Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /Users/hamish/src/swift-test-arena/swift-test-arena/main.swift -target x86_64-apple-macosx13.0 -warn-on-potentially-unavailable-enum-case -enable-objc-interop -color-diagnostics -new-driver-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift -module-name main -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift/host/plugins -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/local/lib/swift/host/plugins -emit-module-doc-path main.swiftdoc -emit-module-source-info-path main.swiftsourceinfo -o main.swiftmodule -emit-abi-descriptor-path main.abi.json
/Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-frontend -frontend -emit-module -primary-file /Users/hamish/src/swift-test-arena/swift-test-arena/main.swift -target x86_64-apple-macosx13.0 -warn-on-potentially-unavailable-enum-case -enable-objc-interop -color-diagnostics -new-driver-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift -module-name main -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift/host/plugins -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/local/lib/swift/host/plugins -o /var/folders/3m/l5fbv4dn6wz112cw2nhjq69h0000gn/T/TemporaryDirectory.TqvOsn/main-1.swiftmodule
❯ ./swiftc -emit-module ~/src/swift-test-arena/swift-test-arena/main.swift -v
Swift version 5.9-dev (LLVM dcb09f599ae5aa9, Swift edc003ac9278d7c)
Target: x86_64-apple-macosx13.0
/Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /Users/hamish/src/swift-test-arena/swift-test-arena/main.swift -target x86_64-apple-macosx13.0 -warn-on-potentially-unavailable-enum-case -enable-objc-interop -color-diagnostics -new-driver-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/bin/swift-driver -empty-abi-descriptor -resource-dir /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift -module-name main -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/lib/swift/host/plugins -plugin-path /Users/hamish/src/swift-dev/build/Release/swift-macosx-x86_64/local/lib/swift/host/plugins -emit-module-doc-path main.swiftdoc -emit-module-source-info-path main.swiftsourceinfo -o main.swiftmodule -emit-abi-descriptor-path main.abi.json
error: emit-module command failed with exit code 1 (use -v to see invocation)
/Users/hamish/src/swift-test-arena/swift-test-arena/main.swift:2365:4: error: expected pattern
var
   ^
error: fatalError

from swift-driver.

artemcm avatar artemcm commented on September 2, 2024

Ugh.
https://github.com/apple/swift-driver/blob/main/Sources/SwiftDriver/Jobs/Planning.swift#L456

from swift-driver.

cpisciotta avatar cpisciotta commented on September 2, 2024

Hi @artemcm. I'm seeing a similar issue with xcodebuild and an Xcode project. Is this likely the same issue? Should I file a separate GitHub issue? I already filed a TSI and FB report with the logs for reference.

from swift-driver.

artemcm avatar artemcm commented on September 2, 2024

@cpisciotta could you please post the FB number here?

from swift-driver.

cpisciotta avatar cpisciotta commented on September 2, 2024

@artemcm FB12568959

from swift-driver.

cpisciotta avatar cpisciotta commented on September 2, 2024

Hey, @artemcm! Just checking in...

  • Should I assume the root cause of this issue is the same as the one I see with xcodebuild? If not, should I create a new GitHub issue?
  • Is there any additional context I can provide to help investigate a fix for this issue?

from swift-driver.

cpisciotta avatar cpisciotta commented on September 2, 2024

Hey, @artemcm. Checking in on this again...

Is there any progress or update on this issue? It's causing some issues for my team when we use xcodebuild. It'd be helpful to set expectations about the priority and timeline for a possible fix.

from swift-driver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.