diff --git a/runtime/tests/checker/range_value_test.go b/runtime/tests/checker/range_value_test.go index 9907de2742..ae6ae2b379 100644 --- a/runtime/tests/checker/range_value_test.go +++ b/runtime/tests/checker/range_value_test.go @@ -404,13 +404,15 @@ func TestInclusiveRangeNonLeafIntegerTypes(t *testing.T) { t.Parallel() - baseValueActivation := sema.NewVariableActivation(sema.BaseValueActivation) - baseValueActivation.DeclareValue(stdlib.InclusiveRangeConstructorFunction) - - options := ParseAndCheckOptions{ - Config: &sema.Config{ - BaseValueActivation: baseValueActivation, - }, + newOptions := func() ParseAndCheckOptions { + baseValueActivation := sema.NewVariableActivation(sema.BaseValueActivation) + baseValueActivation.DeclareValue(stdlib.InclusiveRangeConstructorFunction) + + return ParseAndCheckOptions{ + Config: &sema.Config{ + BaseValueActivation: baseValueActivation, + }, + } } test := func(t *testing.T, ty sema.Type) { @@ -421,7 +423,7 @@ func TestInclusiveRangeNonLeafIntegerTypes(t *testing.T) { let a: %[1]s = 0 let b: %[1]s = 10 var range = InclusiveRange<%[1]s>(a, b) - `, ty), options) + `, ty), newOptions()) errs := RequireCheckerErrors(t, err, 1) assert.IsType(t, &sema.InvalidTypeArgumentError{}, errs[0]) @@ -434,7 +436,7 @@ func TestInclusiveRangeNonLeafIntegerTypes(t *testing.T) { let a: %[1]s = 0 let b: %[1]s = 10 var range: InclusiveRange<%[1]s> = InclusiveRange<%[1]s>(a, b) - `, ty), options) + `, ty), newOptions()) // One for the invocation and another for the type. errs := RequireCheckerErrors(t, err, 2) @@ -448,7 +450,7 @@ func TestInclusiveRangeNonLeafIntegerTypes(t *testing.T) { _, err := ParseAndCheckWithOptions(t, fmt.Sprintf(` let a: InclusiveRange = InclusiveRange(0, 10) let b: InclusiveRange<%s> = a - `, ty), options) + `, ty), newOptions()) errs := RequireCheckerErrors(t, err, 1) assert.IsType(t, &sema.InvalidTypeArgumentError{}, errs[0])