internal FSharpUnionCaseProperty([NotNull] IFieldDeclaration declaration, [NotNull] FSharpUnionCase unionCase)
            : base(declaration)
        {
            UnionCase = unionCase;

            var containingType = declaration.GetContainingTypeDeclaration()?.DeclaredElement;

            ReturnType = containingType != null
        ? TypeFactory.CreateType(containingType)
        : TypeFactory.CreateUnknownType(Module);
        }
        public static FieldContractInfo TryCreate([NotNull] IFieldDeclaration declaration, [NotNull] Func <IType, bool> isAvailableForType)
        {
            if (!declaration.IsStatic &&
                declaration.GetContainingTypeDeclaration() is IClassLikeDeclaration classLikeDeclaration &&
                declaration.DeclaredElement != null &&
                isAvailableForType(declaration.DeclaredElement.Type))
            {
                return(new FieldContractInfo(declaration, classLikeDeclaration, declaration.DeclaredElement.Type));
            }

            return(null);
        }