Skip to content

Commit

Permalink
use new isPrimitiveType function
Browse files Browse the repository at this point in the history
  • Loading branch information
dsainati1 committed Dec 15, 2023
1 parent f94e4d0 commit 6806c3b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions runtime/sema/check_composite_declaration.go
Original file line number Diff line number Diff line change
Expand Up @@ -2046,14 +2046,9 @@ func (checker *Checker) checkDefaultDestroyEventParam(
}
param.DefaultArgument = checker.VisitExpression(paramDefaultArgument, paramType)

unwrappedParamType := UnwrapOptionalType(paramType)
// default events must have default arguments for all their parameters; this is enforced in the parser
// we want to check that these arguments are all either literals or field accesses, and have primitive types
if !IsSubType(unwrappedParamType, StringType) &&
!IsSubType(unwrappedParamType, NumberType) &&
!IsSubType(unwrappedParamType, TheAddressType) &&
!IsSubType(unwrappedParamType, PathType) &&
!IsSubType(unwrappedParamType, BoolType) {
if !paramType.IsPrimitiveType() {
checker.report(&DefaultDestroyInvalidParameterError{
ParamType: paramType,
Range: ast.NewRangeFromPositioned(checker.memoryGauge, astParam),
Expand Down

0 comments on commit 6806c3b

Please sign in to comment.