Skip to content

Commit

Permalink
more comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ltzmaxwell committed Jun 18, 2024
1 parent 91a2129 commit 49e6030
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gnovm/pkg/gnolang/type_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,13 @@ func (x *BinaryExpr) AssertCompatible(lt, rt Type) {
}
}

// Check compatibility of the destination type (dt) with the operator.
// If both source type (xt) and destination type (dt) are typed:
// Verify that xt is assignable to dt.
// If xt is untyped:
// The function checkOrConvertType will be invoked after this check.
// NOTE: dt is established based on a specificity check between xt and dt,
// confirming dt as the appropriate destination type for this context.
func (x *BinaryExpr) checkCompatibility(xt, dt Type, checker func(t Type) bool, OpStr string) {
if !checker(dt) {
panic(fmt.Sprintf("operator %s not defined on: %v", OpStr, kindString(dt)))
Expand Down

0 comments on commit 49e6030

Please sign in to comment.