// RUN: %target-typecheck-verify-swift -requirement-machine-inferred-signatures=on

protocol P {
  associatedtype A
  associatedtype AS: Q where AS.B == A
}

protocol Q {
  associatedtype B
}

struct S1<T : P> where T.AS.B == T.A {}
// expected-warning@-1 {{redundant same-type constraint 'T.AS.B' == 'T.A'}}

struct S2<T: P> {
  struct Nested where T.AS.B == T.A {}
  // expected-warning@-1 {{redundant same-type constraint 'T.AS.B' == 'T.A'}}
}

extension S2 where T.AS.B == T.A {}
// expected-warning@-1 {{redundant same-type constraint 'T.AS.B' == 'T.A'}}

extension P where AS.B == A {}
// expected-warning@-1 {{redundant same-type constraint 'Self.AS.B' == 'Self.A'}}

extension P where Self : P {}
// expected-warning@-1 {{redundant conformance constraint 'Self' : 'P'}}

Add redundant requirements diagnostic test that used to fail with the GSB
RequirementMachine: Add redundant requirements diagnostic test that used to fail with the GSB

For some reason we didn't diagnose some of the redundancies here;
the new logic in the Requirement Machine works just fine though!

https://bugs.swift.org/browse/SR-14917 / rdar://problem/80820294
