diff --git a/runtime/tests/interpreter/dynamic_casting_test.go b/runtime/tests/interpreter/dynamic_casting_test.go index 6113f960f6..b3d90899f5 100644 --- a/runtime/tests/interpreter/dynamic_casting_test.go +++ b/runtime/tests/interpreter/dynamic_casting_test.go @@ -3899,7 +3899,6 @@ func TestInterpretDynamicCastingReferenceCasting(t *testing.T) { type testCase struct { operation ast.Operation returnsOptional bool - checkError func(t *testing.T, err error) } test := func(testCase testCase) { @@ -3953,7 +3952,12 @@ func TestInterpretDynamicCastingReferenceCasting(t *testing.T) { _, err := inter.Invoke("test") RequireError(t, err) - testCase.checkError(t, err) + // StorageReferenceValue.ReferencedValue turns the ForceCastTypeMismatchError + // of the failed dereference into a DereferenceError + var dereferenceError interpreter.DereferenceError + require.ErrorAs(t, err, &dereferenceError) + + assert.Equal(t, 22, dereferenceError.LocationRange.StartPosition().Line) }) } @@ -3961,22 +3965,10 @@ func TestInterpretDynamicCastingReferenceCasting(t *testing.T) { { operation: ast.OperationForceCast, returnsOptional: false, - checkError: func(t *testing.T, err error) { - // StorageReferenceValue.ReferencedValue turns the ForceCastTypeMismatchError - // of the failed dereference into a DereferenceError - var dereferenceError interpreter.DereferenceError - require.ErrorAs(t, err, &dereferenceError) - - assert.Equal(t, 22, dereferenceError.LocationRange.StartPosition().Line) - }, }, { operation: ast.OperationFailableCast, returnsOptional: true, - checkError: func(t *testing.T, err error) { - var mismatchError interpreter.ForceCastTypeMismatchError - require.ErrorAs(t, err, &mismatchError) - }, }, }