[SR-8109] Swift 4.2 Regression: Single-element tuple not prevented #50641
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
regression
swift 4.2
Environment
Xcode 10 beta 1, Xcode 10 beta 2, recent dev snapshots
Additional Detail from JIRA
md5: a1a43661b0f49d77dcf52bd812ef1d1e
Issue Description:
Related thread (which I wish got some clarifications from the core team): https://forums.swift.org/t/roadmap-for-and-state-of-single-element-tuple-types/13711
As far as I understand, single element tuples should be prevented in Swift.
The following program does not compile with (the default toolchain of) Xcode 9.4, as expected.
BUT with recent versions of the compiler (default toolchains of Xcode 10 beta 1 and beta 2, as well as recent dev snapshots), it does compile.
So we can define `t` to be of an instance of a (labeled) single-element tuple type, and use it as such.
(
But we cannot dump or print or otherwise access its type without getting (nonsensical) errors, and we cannot define its type explicitly, meaning the following will not compile:
)
Also, as a side note, the following program compiles with all versions of the compiler (including Xcode 9.4):
But I guess it shouldn't?
The text was updated successfully, but these errors were encountered: