private static bool ParameterMatches()

in src/Kusto.Language/Editor/Kusto/KustoCompleter.cs [2229:2301]


        private static bool ParameterMatches(Parameter parameter, TypeSymbol type)
        {
            switch (parameter.TypeKind)
            {
                case ParameterTypeKind.Declared:
                    if (Binder.SymbolsAssignable(parameter.DeclaredTypes, type))
                    {
                        return true;
                    }
                    else if (Binder.IsPromotable(type, parameter.DeclaredTypes[0]))
                    {
                        return true;
                    }
                    break;

                case ParameterTypeKind.Scalar:
                    return type.IsScalar;

                case ParameterTypeKind.Integer:
                    return type is ScalarSymbol s && s.IsInteger;

                case ParameterTypeKind.RealOrDecimal:
                    return type == ScalarTypes.Real || type == ScalarTypes.Decimal;

                case ParameterTypeKind.StringOrDynamic:
                    return type == ScalarTypes.String || type == ScalarTypes.Dynamic;

                case ParameterTypeKind.Number:
                    return type is ScalarSymbol s2 && s2.IsNumeric;

                case ParameterTypeKind.NumberOrBool:
                    return type is ScalarSymbol s2b && (s2b.IsNumeric || s2b == ScalarTypes.Bool);

                case ParameterTypeKind.Summable:
                    return type is ScalarSymbol s3 && s3.IsSummable;

                case ParameterTypeKind.Orderable:
                    return type is ScalarSymbol s4 && s4.IsOrderable;

                case ParameterTypeKind.Tabular:
                    return type.IsTabular;

                case ParameterTypeKind.Database:
                    return type is DatabaseSymbol;

                case ParameterTypeKind.Cluster:
                    return type is ClusterSymbol;

                case ParameterTypeKind.NotBool:
                    return type is ScalarSymbol && type != ScalarTypes.Bool;

                case ParameterTypeKind.NotRealOrBool:
                    return type is ScalarSymbol && type != ScalarTypes.Real && type != ScalarTypes.Bool;

                case ParameterTypeKind.NotDynamic:
                    return type is ScalarSymbol && type != ScalarTypes.Dynamic;

                case ParameterTypeKind.IntegerOrDynamic:
                    return (type is ScalarSymbol s5 && s5.IsInteger) || type == ScalarTypes.Dynamic;

                case ParameterTypeKind.Parameter0:
                case ParameterTypeKind.Parameter1:
                case ParameterTypeKind.Parameter2:
                case ParameterTypeKind.CommonScalar:
                case ParameterTypeKind.CommonNumber:
                case ParameterTypeKind.CommonSummable:
                case ParameterTypeKind.CommonOrderable:
                case ParameterTypeKind.CommonScalarOrDynamic:
                    return type is ScalarSymbol;
            }

            return false;
        }