Skip to content

Conversation

phausler
Copy link
Member

This is a proof of concept for https://forums.swift.org/t/pitch-buildpartialblock-for-result-builders/55561 usage. It allows us to ferry full information of where the failure occurs as a source location; and potentially even string index in that output.

The errors are MUCH easier to identify using this approach because now they can emit directly where the expectation failure occurs.

Package.swift Outdated
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"]),
dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"],
swiftSettings: [
.unsafeFlags(["-Xfrontend", "-enable-experimental-pairwise-build-block"])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for now until that feature lands. Right now if you want to try out the branch you have to use the latest toolchain download from swift.org.

AccumulatedInputsWithOperation(inputs: [], operation: operation)
}

public static func buildBlock(combining input: String, into accumulated: AccumulatedInputs, file: StaticString = #file, line: UInt = #line) -> AccumulatedInputs {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This syntax will eventually be altered slightly but the same concept will be available.

Copy link
Member

@parkera parkera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! Can you show what the output looks like with the failure now?

@phausler
Copy link
Member Author

I could reconstitute the output if we wanted as additional diagnostics.

Copy link
Member

@rxwei rxwei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@rxwei
Copy link
Member

rxwei commented Feb 26, 2022

FYI this PR implements the new name buildPartialBlock: swiftlang/swift#41576. It should get in a new toolchain some time next week.

@phausler phausler force-pushed the pr/pairwise_build_block branch from 02a0ab4 to cc05f49 Compare March 14, 2022 19:27
.unsafeFlags([
"-Xfrontend", "-disable-availability-checking"
"-Xfrontend", "-disable-availability-checking",
"-Xfrontend", "-enable-experimental-pairwise-build-block"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now available as of the 3/9 toolchain

@phausler phausler requested a review from rxwei March 14, 2022 19:46
@phausler phausler merged commit 9d46190 into main Mar 14, 2022
@phausler phausler deleted the pr/pairwise_build_block branch March 14, 2022 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants