private void ValidateImplementation(TypeDefinitionSyntax pTrait, TypeDefinitionSyntax pImplement) { //Ensure that all fields are in the implementation foreach (var tf in pTrait.Fields) { bool found = false; foreach (var f in pImplement.Fields) { if (tf.Value == f.Value) { found = true; break; } } if (!found) { CompilerErrors.ImplementationMissingField(tf.Value, pTrait, pImplement.Span); } } //Ensure that all methods are in the implementation foreach (var tm in pTrait.Methods) { bool found = false; foreach (var im in pImplement.Methods) { if (im.Name == tm.Name && im.Parameters.Count == tm.Parameters.Count) { found = true; break; } } if (!found) { CompilerErrors.ImplementationMissingMethod(tm.Name, pTrait, pImplement.Span); } } }