Skip to content

tests: Add a missing typealias test case and verifications for a few FIXMEs #60972

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
Oct 10, 2022

Conversation

AnthonyLatsis
Copy link
Collaborator

No description provided.

@AnthonyLatsis
Copy link
Collaborator Author

@slavapestov ping

// This occurs because the constraint solver does the wrong thing with an
// UnresolvedSpecializeExpr applied to a generic typealias.
//
// In the other cases, we manage to fold the UnresolvedSpecializeExpr in the
// precheckExpression() phase, which handles generic typealiases correctly.

let _ = GenericClass.TA<Float>(a: 4.0, b: 1) // FIXME
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these might still be wrong? Can you verify that it produces the correct underlying type vs when the alias appears in type context?

Copy link
Collaborator Author

@AnthonyLatsis AnthonyLatsis Sep 22, 2022

Choose a reason for hiding this comment

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

Oh, good catch, you’re right! What an odd bug though; I will bring back the FIXMEs and add a verification of this error.

struct S<X, Y> {
  var x: X, y: Y
}
class C<T> {
  typealias TA<U> = S<T, U>
}

let s1 = C.TA<Float>(x: 4.0, y: 1)
let s2: S<Double, Float> = s1 // cannot assign value of type 'S<Float, Int>' to type 'S<Double, Float>'

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the bug is because SpecializeExpr doesn't handle type alias types correctly. It just desugars the underlying type.

@AnthonyLatsis AnthonyLatsis changed the title [NFC] Add a missing typealias test case and remove a few stale FIXMEs therein [NFC] Add a missing typealias test case and verifications for a few FIXMEs therein Sep 27, 2022
@AnthonyLatsis AnthonyLatsis changed the title [NFC] Add a missing typealias test case and verifications for a few FIXMEs therein [NFC] Add a missing typealias test case and verifications for a few FIXMEs Oct 6, 2022
@AnthonyLatsis AnthonyLatsis changed the title [NFC] Add a missing typealias test case and verifications for a few FIXMEs tests: Add a missing typealias test case and verifications for a few FIXMEs Oct 6, 2022
@AnthonyLatsis
Copy link
Collaborator Author

@slavapestov ping

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test

@AnthonyLatsis AnthonyLatsis merged commit 1cb0764 into swiftlang:main Oct 10, 2022
@AnthonyLatsis AnthonyLatsis deleted the typealias-test branch October 10, 2022 22:55
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