TypeCheck implements the Expr interface.
( ctx context.Context, semaCtx *SemaContext, desired *types.T, )
| 501 | |
| 502 | // TypeCheck implements the Expr interface. |
| 503 | func (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. |
| 529 | func (expr *CollateExpr) TypeCheck( |
nothing calls this directly
no test coverage detected