-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[CSBindings] Cleanup literal binding inference #15489
Conversation
@swift-ci please test source compatibility |
In the expressions like: var foo: String? = "hello"
public func bar<T : Equatable>(_ a: @autoclosure () throws -> T, _ b: @autoclosure () throws -> T) {}
bar(foo, "Yes") We end up loosing |
@@ -1,4 +1,4 @@ | |||
// RUN: %scale-test --invert-result --begin 1 --end 5 --step 1 --select incrementScopeCounter %s | |||
// RUN: not %scale-test --invert-result --begin 1 --end 5 --step 1 --select incrementScopeCounter %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting returning "too complex" in different spots, didn't know how to make it work otherwise...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this change instead remove --invert-result
and move the test to fast/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this one didn't improve but now produces "too complex" in one of the chained "+" which I don't know how to mark with expected-error
so I added not
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then I think we should open a bug and just disable the test now. It's taking several minutes to run on my machine. You can feel free to merge this and then disable as a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've created rdar://problem/38963783 and going to merge this all together, there is no rush.
Looks like this exposed one more problem with join, but i don’t think we should be joining with literals anyway. |
22e833f
to
531a222
Compare
@swift-ci please test source compatibility |
@swift-ci please smoke test compiler performance |
531a222
to
0ab8721
Compare
@swift-ci please test source compatibility |
@swift-ci please clean test |
Build failed |
Test |
@swift-ci please test macOS platform |
!binding.BindingType->hasTypeVariable() && !binding.DefaultedProtocol && | ||
!binding.isDefaultableBinding() && allowJoinMeet) { | ||
!binding.BindingType->hasTypeVariable() && | ||
!binding.BindingType->hasUnboundGenericType() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the diff here is checking for hasUnboundGenericType()
.
It's not clear to me why we would have to do that here. It's possible join
was hitting an llvm_unreachable
, but I recently fixed that to return Unimplemented
in the cases we aren't currently handling - it was an oversight that I checked in the llvm_unreachable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added that because Kickstarter-Prelude
has hitting "non-canonical or unchecked type" llvm_unreachable
which trying to join Array
and [String]?
since Array
is 'UnboundGenericType` which is "unchecked".
test/Constraints/rdar38535743.swift
Outdated
// RUN: %target-typecheck-verify-swift | ||
// REQUIRES: objc_interop | ||
|
||
import Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use the mock SDK. Grep for 'mock-sdk' e.g. in tests/Constraints/*_objc.swift
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Don't attempt to store literal bindings directly to `PotentialBindings` since they might get superseded by non-literal bindings deduced from other constraints, also don't attempt to check literal protocol conformance on type variables or member types since such types would always end-up returning trivial conformance which results in removal of viable literal types. Resolves: rdar://problem/38535743
0ab8721
to
298bf2a
Compare
@swift-ci please clean test |
@swift-ci please smoke test |
Don't attempt to store literal bindings directly to
PotentialBindings
since they might get superseded by non-literal bindings deduced from
other constraints, also don't attempt to check literal protocol conformance
on type variables or member types since such types would always end-up
returning trivial conformance which results in removal of viable literal types.
Resolves: rdar://problem/38535743