In the above code T: P says that "every type in the pack T has to conform to P". In the implementation of G, T.A is a pack that contains the associated A type of every type in the pack T. Similarly, T.B is a pack that contains the associated type B of every type in the pack T.
For example:
struct S: P {
typealias A = Int
typealias B = String
}
struct R<A, B>: P {}
let g = G<S, R>()
// T := {S, R}
// T.A := {Int, R.A}
// T.B := {String, R.B}