Exemple #1
0
        private void RegisterType(Type type)
        {
            Contract.Requires(type != null);
            if (KnownTypes.Contains(type))
            {
                return;
            }

            if (type.IsMap && CommandLineOptions.Clo.TypeEncodingMethod == CommandLineOptions.TypeEncoding.Monomorphic)
            {
                KnownTypes.Add(type);
                MapType mapType = type.AsMap;
                Contract.Assert(mapType != null);

                foreach (Type t in mapType.Arguments)
                {
                    Contract.Assert(t != null);
                    RegisterType(t);
                }
                RegisterType(mapType.Result);

                if (!CommandLineOptions.Clo.UseArrayTheory)
                {
                    AddDeclaration("(declare-sort " + TypeToString(type) + " 0)");
                }

                return;
            }

            if (type.IsBool || type.IsInt || type.IsReal || type.IsBv || type.IsFloat || type.IsRMode || type.IsString || type.IsRegEx)
            {
                return;
            }

            CtorType ctorType = type as CtorType;

            if (ctorType != null)
            {
                // Check if this is a built-in type.  If so, no declaration is needed.
                string decl = ctorType.GetBuiltin();
                if (decl != null)
                {
                    KnownTypes.Add(type);
                    return;
                }
                if (ctorType.IsDatatype())
                {
                    return;
                }
            }

            if (CommandLineOptions.Clo.TypeEncodingMethod == CommandLineOptions.TypeEncoding.Monomorphic)
            {
                AddDeclaration("(declare-sort " + TypeToString(type) + " 0)");
                KnownTypes.Add(type);
                return;
            }
        }
Exemple #2
0
 public static void RegisterKnownType(IEnumerable <Type> types)
 {
     foreach (var type in types)
     {
         if (!KnownTypes.Contains(type))
         {
             KnownTypes.Add(type);
         }
     }
 }
Exemple #3
0
        private void RegisterType(Type type)
        {
            Contract.Requires(type != null);
            if (KnownTypes.Contains(type))
            {
                return;
            }

            if (type.IsMap && CommandLineOptions.Clo.MonomorphicArrays)
            {
                KnownTypes.Add(type);
                MapType mapType = type.AsMap;
                Contract.Assert(mapType != null);

                foreach (Type t in mapType.Arguments)
                {
                    Contract.Assert(t != null);
                    RegisterType(t);
                }
                RegisterType(mapType.Result);

                if (!CommandLineOptions.Clo.UseArrayTheory)
                {
                    AddDeclaration("(declare-sort " + TypeToString(type) + " 0)");
                }

                return;
            }

            if (type.IsBool || type.IsInt || type.IsReal || type.IsBv || type.IsFloat)
            {
                return;
            }

            CtorType ctorType = type as CtorType;

            if (ctorType != null && ctorType.IsDatatype())
            {
                return;
            }

            if (CommandLineOptions.Clo.TypeEncodingMethod == CommandLineOptions.TypeEncoding.Monomorphic)
            {
                AddDeclaration("(declare-sort " + TypeToString(type) + " 0)");
                KnownTypes.Add(type);
                return;
            }
        }
        private string ResolveFullName(string type)
        {
            if (genericTypes == null)
            {
                genericTypes = GetGenericParametersInContext(Context);
            }

            if (genericTypes.TryGetValue(type.ToString(), out var genericType))
            {
                return(genericType);
            }

            if (Usings == null || KnownTypes == null)
            {
                return(type);
            }

            return(Usings
                   .Select(x => x + "." + type)
                   .FirstOrDefault(x => KnownTypes.Contains(x)) ??
                   type);
        }
 internal static bool IsSpecifiedKnownType(string fullType)
 {
     return(KnownTypes.Contains(fullType));
 }
        internal static bool IsKnownType(string fullType)
        {
            var _fullType = fullType.ToLower();

            return(DiscoveredTypes.ContainsKey(_fullType) || KnownTypes.Contains(_fullType));
        }