Closed dabrahams closed 6 years ago
@swift-ci create
/cc @moiseev
A little more details:
This is happening in Swift 4 mode (Swift 3 only warns about the deprecation of this overload). Also there is a note that the compiler generates:
Swift.Strideable:9:24: note: '-' was obsoleted in Swift 4
public static func -(lhs: Self, rhs: Self) -> Self.Stride
^
This is all happening because of the -
overload on Strideable
of type (Self, Self) -> Self.Stride
.
I guess what's happening is as follows:
The compiler sees &<<
with an Int
on the left and tries to solve the expression with a homogeneous overload;
"Fortunately" there is a possible solution for 1 - y
that returns an Int
, and that's that Strideable
overload (even though it's marked as obsoleted).
For some reason, compiler does not seem to try another possible solution, a homogeneous -
defined on Int
.
Same expression compiles just fine, should you change the type of x
to something other than {{Int}.
This typechecks in Xcode 9.3, 10, and ToT Swift.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, TypeChecker | |Assignee | None | |Priority | Medium | md5: 36371a7bd73751fcd8ec14128add5cc6is duplicated by:
Issue Description:
On GitHub/master, for a long time, we've had: