Skip to content
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

[SR-9595] Unexpected error when type checking constrained associated types #52042

Closed
rxwei opened this issue Jan 3, 2019 · 5 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@rxwei
Copy link
Member

rxwei commented Jan 3, 2019

Previous ID SR-9595
Radar rdar://problem/75329340
Original Reporter @rxwei
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee @slavapestov
Priority Medium

md5: 566220f9d77423bbecc919b4912e7ab1

relates to:

  • TF-213 [AD] Fix Differentiable protocol generic signature bug

Issue Description:

I expect the following to compile:

protocol Q {
  associatedtype Assoc
}

protocol P {
  associatedtype T : P, Q where T.Assoc : FloatingPoint, T == U.U
  associatedtype U : P, Q where U.Assoc : FloatingPoint, U == T.U
}

... but the compiler produces a ton of warnings that don't really make sense.

sr9595.swift:6:22: warning: redundant conformance constraint 'Self.T': 'P'
  associatedtype T : P, Q where T.Assoc : FloatingPoint, T == U.U
                     ^
sr9595.swift:7:22: note: conformance constraint 'Self.T.T': 'P' implied here
  associatedtype U : P, Q where U.Assoc : FloatingPoint, U == T.U
                     ^
sr9595.swift:6:25: warning: redundant conformance constraint 'Self.T': 'Q'
  associatedtype T : P, Q where T.Assoc : FloatingPoint, T == U.U
                        ^
sr9595.swift:7:22: note: conformance constraint 'Self.T.T': 'Q' implied here
  associatedtype U : P, Q where U.Assoc : FloatingPoint, U == T.U
                     ^
sr9595.swift:6:41: warning: redundant conformance constraint 'Self.T.Assoc': 'FloatingPoint'
  associatedtype T : P, Q where T.Assoc : FloatingPoint, T == U.U
                                        ^
sr9595.swift:7:22: note: conformance constraint 'Self.T.T.Assoc': 'FloatingPoint' implied here
  associatedtype U : P, Q where U.Assoc : FloatingPoint, U == T.U
                     ^
sr9595.swift:7:25: warning: redundant conformance constraint 'Self.U': 'Q'
  associatedtype U : P, Q where U.Assoc : FloatingPoint, U == T.U
                        ^
sr9595.swift:7:22: note: conformance constraint 'Self.U': 'Q' implied here
  associatedtype U : P, Q where U.Assoc : FloatingPoint, U == T.U
                     ^
sr9595.swift:7:41: warning: redundant conformance constraint 'Self.U.Assoc': 'FloatingPoint'
  associatedtype U : P, Q where U.Assoc : FloatingPoint, U == T.U
                                        ^
sr9595.swift:7:22: note: conformance constraint 'Self.U.Assoc': 'FloatingPoint' implied here
  associatedtype U : P, Q where U.Assoc : FloatingPoint, U == T.U
                     ^
@belkadan
Copy link
Contributor

belkadan commented Jan 7, 2019

cc @DougGregor, @slavapestov

@dan-zheng
Copy link
Collaborator

@DougGregor: you said that this is a generic signature minimization bug.
Could you please give some pointers towards debugging/fixing this issue in lib/AST/GenericSignatureBuilder.cpp? That would be much appreciated.

@slavapestov
Copy link
Member

@swift-ci create

@slavapestov
Copy link
Member

Nice test case!

@slavapestov
Copy link
Member

#42113

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants