Skip to content

[CSSimplify] Attempt property wrapper fix after restrictions #30129

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

Merged
merged 1 commit into from
Feb 28, 2020
Merged

[CSSimplify] Attempt property wrapper fix after restrictions #30129

merged 1 commit into from
Feb 28, 2020

Conversation

theblixguy
Copy link
Collaborator

The following code:

struct User {}

@propertyWrapper struct Wrapper<T> {
  var wrappedValue: T
}

class Test {
  @Wrapper var user: User?
}

func genericFunc<T>(_ argument: T?) -> T? {
  return argument
}

let test = Test()
genericFunc(test.user)

fails to compile with a very strange error - cannot convert value 'user' of type 'User?' to expected type 'Wrapper<User?>?', use wrapper instead.

This seems to be because we're attempting property wrapper fix (and creating subtype constraints) before we've given simplifyRestrictedConstraintImpl a chance to handle any restrictions. So, delay the attempt to create a fix so restrictions can be handled first.

Resolves SR-11654, SR-12233
Resolves rdar://problem/56543018

@theblixguy theblixguy requested a review from xedin February 28, 2020 21:28
Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

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

Thank you!

@theblixguy
Copy link
Collaborator Author

@swift-ci please smoke test

@theblixguy
Copy link
Collaborator Author

@xedin Is this worth cherry-picking to 5.2? :)

@xedin
Copy link
Contributor

xedin commented Feb 28, 2020

I think it might be too late already, but I'll double-check...

@xedin
Copy link
Contributor

xedin commented Feb 28, 2020

Yeah, unfortunately no more 5.2 changes are accepted at this point.

@theblixguy
Copy link
Collaborator Author

@xedin Okay, no worries :)

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.

2 participants