Skip to content

[stdlib] Remove the UnboundedRange_ enum #18649

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions stdlib/public/core/Range.swift
Original file line number Diff line number Diff line change
Expand Up @@ -827,22 +827,7 @@ extension Comparable {
/// let word2 = "grisly"
/// let changes = countLetterChanges(word1[...], word2[...])
/// // changes == 2
@_frozen // namespace
public enum UnboundedRange_ {
// FIXME: replace this with a computed var named `...` when the language makes
// that possible.

/// Creates an unbounded range expression.
///
/// The unbounded range operator (`...`) is valid only within a collection's
/// subscript.
public static postfix func ... (_: UnboundedRange_) -> () {
// This function is uncallable
}
}

/// The type of an unbounded range operator.
public typealias UnboundedRange = (UnboundedRange_)->()
public typealias UnboundedRange = (Never) -> PartialRangeFrom<Never>

extension Collection {
/// Accesses the contiguous subrange of the collection's elements specified
Expand Down
2 changes: 2 additions & 0 deletions test/api-digester/Outputs/stability-stdlib-abi.swift.expected
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ Var _RawDictionaryStorage.empty has declared type change from _EmptyDictionarySi
Var _RawSetStorage.empty has declared type change from _EmptySetSingleton to __EmptySetSingleton

Func tryReallocateUniquelyReferenced(buffer:newMinimumCapacity:) has been removed

Enum UnboundedRange_ has been removed
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Func tryReallocateUniquelyReferenced(buffer:newMinimumCapacity:) has been removed

/* FIXME(SR-9283): TypeAlias UnboundedRange has underlying type change from (UnboundedRange_) -> () to (Never) -> PartialRangeFrom<Never> */
Enum UnboundedRange_ has been removed
2 changes: 1 addition & 1 deletion test/type/types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var d4 : () -> Int = { d2 } // expected-error{{function produces expected type

var e0 : [Int]
e0[] // expected-error {{cannot subscript a value of type '[Int]' with an index of type '()'}}
// expected-note @-1 {{overloads for 'subscript' exist with these partially matching parameter lists: ((UnboundedRange_) -> ()), (Int), (R), (Range<Int>), (Range<Self.Index>)}}
// expected-note @-1 {{overloads for 'subscript' exist with these partially matching parameter lists: ((Never) -> PartialRangeFrom<Never>), (Int), (R), (Range<Int>), (Range<Self.Index>)}}

var f0 : [Float]
var f1 : [(Int,Int)]
Expand Down