classPrefixTyping
final class PrefixTyping
Types prefix operator applications.
Rule: PG-PREFIX-TYPING-001. The parser folds - before a numeric constant, parenthesized or not, into a negative constant: it is integer from -2147483648, bigint from -9223372036854775808 and numeric beyond, and never NULL. Otherwise the catalog prefix operators keep a number or interval type for - and +, a number type for @, give double precision for |/ and ||/, keep an integer, bit string or inet type for ~ and tsquery for !!; any other operand or operator depends on a declaration (PG-OPERATOR-TYPING-001). The operators are strict. Termination: constant work. Source: https://www.postgresql.org/docs/17/functions-math.html, https://www.postgresql.org/docs/17/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC. Status: Implemented.
Methods§
public function prefix(
AnalysisContext $context,
OperatorName $operator,
ScalarFact $operand,
Scalar $node,
): ScalarFactTypes a prefix operator application; - before a numeric constant is typed as the negative constant it folds to.
Parameters
$context | AnalysisContext | |
$operator | OperatorName | |
$operand | ScalarFact | |
$node | Scalar |
Returns
Test cases 1
Called from 1
Calls 7
- new ScalarFact line 51
- new Known line 51
- method-call PrefixTyping::negative() line 51
- class-const Nullability::NotNull() line 51
- method-call PrefixTyping::unary() line 54
- method-call OperandChecks::nullability() line 54
- new OperandChecks line 54
public function negative(IntegerConstant|NumericConstant $value): BuiltinAnswers the type of a negative numeric constant: integer from -2147483648, bigint from -9223372036854775808, numeric beyond.
Parameters
Returns
Test cases 1
Called from 1
Calls 6
- new Numerals line 62
- method-call Numerals::integer() line 63
- class-const Builtin::Numeric() line 65
- method-call Numerals::within() line 67
- class-const Builtin::Int4() line 68
- class-const Builtin::Int8() line 71
public function unary(
AnalysisContext $context,
OperatorName $operator,
TypeFact $operand,
): TypeFactTypes a prefix operator over the type of its operand.
Parameters
$context | AnalysisContext | |
$operator | OperatorName | |
$operand | TypeFact |
Returns
Test cases 1
Called from 1
Calls 17
- method-call Categories::builtin() line 83
- new Categories line 83
- method-call OperatorTyping::visible() line 84
- new OperatorTyping line 84
- class-const Builtin::Unknown() line 84
- method-call OperatorTyping::undeclared() line 85
- class-const Arithmetic::INTEGERS() line 87
- class-const Builtin::Numeric() line 87
- class-const Builtin::Float4() line 87
- class-const Builtin::Float8() line 87
- class-const Builtin::Interval() line 89
- class-const Builtin::Bit() line 90
- class-const Builtin::Varbit() line 90
- class-const Builtin::Inet() line 90
- class-const Builtin::Tsquery() line 90
- function-call
in_arrayline 92 - new Known line 93
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.