internal static bool TryAssertPathAsType(this IEdmPathExpression expression, IEdmTypeReference type, IEdmType context, bool matchExactly, out IEnumerable <EdmError> discoveredErrors) { IEdmStructuredType structuredContext = context as IEdmStructuredType; if (structuredContext != null) { IEdmType result = context; foreach (string segment in expression.Path) { IEdmStructuredType structuredResult = result as IEdmStructuredType; if (structuredResult == null) { discoveredErrors = new EdmError[] { new EdmError(expression.Location(), EdmErrorCode.PathIsNotValidForTheGivenContext, Edm.Strings.EdmModel_Validator_Semantic_PathIsNotValidForTheGivenContext(segment)) }; return(false); } IEdmProperty resultProperty = structuredResult.FindProperty(segment); result = (resultProperty != null) ? resultProperty.Type.Definition : null; // If the path is not resolved, it could refer to an open type, and we cannot make an assertion about its type. if (result == null) { discoveredErrors = Enumerable.Empty <EdmError>(); return(true); } } return(TestTypeMatch(result, type.Definition, expression.Location(), matchExactly, out discoveredErrors)); } discoveredErrors = Enumerable.Empty <EdmError>(); return(true); }