MCPcopy Create free account
hub / github.com/dolthub/doltgresql / TypeCheck

Method TypeCheck

postgres/parser/sem/tree/type_check.go:503–526  ·  view source on GitHub ↗

TypeCheck implements the Expr interface.

(
	ctx context.Context, semaCtx *SemaContext, desired *types.T,
)

Source from the content-addressed store, hash-verified

501
502// TypeCheck implements the Expr interface.
503func (expr *AnnotateTypeExpr) TypeCheck(
504 ctx context.Context, semaCtx *SemaContext, desired *types.T,
505) (TypedExpr, error) {
506 annotateType, err := ResolveType(ctx, expr.Type, semaCtx.GetTypeResolver())
507 if err != nil {
508 return nil, err
509 }
510 expr.Type = annotateType
511 subExpr, err := typeCheckAndRequire(
512 ctx,
513 semaCtx,
514 expr.Expr,
515 annotateType,
516 fmt.Sprintf(
517 "type annotation for %v as %s, found",
518 expr.Expr,
519 annotateType,
520 ),
521 )
522 if err != nil {
523 return nil, err
524 }
525 return subExpr, nil
526}
527
528// TypeCheck implements the Expr interface.
529func (expr *CollateExpr) TypeCheck(

Callers

nothing calls this directly

Calls 3

typeCheckAndRequireFunction · 0.85
GetTypeResolverMethod · 0.80
ResolveTypeFunction · 0.70

Tested by

no test coverage detected