diff --git a/starlark/eval_test.go b/starlark/eval_test.go index 13876a72..00b6e6d1 100644 --- a/starlark/eval_test.go +++ b/starlark/eval_test.go @@ -509,7 +509,7 @@ func TestBacktrace(t *testing.T) { // functions, including propagation through built-ins such as 'min'. const src = ` def f(x): return 1//x -def g(x): f(x) +def g(x): return f(x) def h(): return min([1, 2, 0], key=g) def i(): return h() i() @@ -522,7 +522,7 @@ i() crash.star:5:18: in i crash.star:4:20: in h : in min - crash.star:3:12: in g + crash.star:3:19: in g crash.star:2:19: in f Error: floored division by zero` if got := backtrace(t, err); got != want { diff --git a/starlark/testdata/misc.star b/starlark/testdata/misc.star index 84ef84c1..e7e0c063 100644 --- a/starlark/testdata/misc.star +++ b/starlark/testdata/misc.star @@ -39,6 +39,7 @@ load("assert.star", "assert") # Ordered comparisons require values of the same type. +assert.fails(lambda: None < None, "not impl") assert.fails(lambda: None < False, "not impl") assert.fails(lambda: False < list, "not impl") assert.fails(lambda: list < {}, "not impl") diff --git a/starlark/value.go b/starlark/value.go index 8d1b88a1..bcec7508 100644 --- a/starlark/value.go +++ b/starlark/value.go @@ -132,7 +132,6 @@ type Comparable interface { } var ( - _ Comparable = None _ Comparable = Int{} _ Comparable = False _ Comparable = Float(0) @@ -354,9 +353,6 @@ func (NoneType) Type() string { return "NoneType" } func (NoneType) Freeze() {} // immutable func (NoneType) Truth() Bool { return False } func (NoneType) Hash() (uint32, error) { return 0, nil } -func (NoneType) CompareSameType(op syntax.Token, y Value, depth int) (bool, error) { - return threeway(op, 0), nil -} // Bool is the type of a Starlark bool. type Bool bool