Page 1 of 1

Type-incompatible comparisons accepted

Posted: Sun Jun 22, 2014 4:05 pm
by HughDarwen
Comparisons of tuple expressions of different types and comparisons of expressions of different user-defined scalar types are sometimes accepted instead of giving type errors, as the script below shows. I also tried the comparison t4(10, 20) < t6(10, 'abc') and that caused Rel to crash.


tuple{x 1} = tuple{y 2, x 1}
true

tuple{x 1} = tuple{y 1, x 2}
false

tuple{x 1} < tuple{y 1, x 2}

ERROR: Ordinal comparison operators not supported by TUPLE.
Line 1, column 27 near '2'



type t1 possrep{x int};
type t2 possrep{x int};
type t3 possrep{y int};


Ok.
t1(10) = t2(10)
true

t1(10) = t2(20)
false

t1(10) = t3(10)
true

t1(10) = t3(20)
false

t1(10) < t3(20)
true

t1(10) < t3(10)
false

type t4 possrep{x int, y int};
type t5 possrep{x int, z int};
type t6 possrep{y int, z char};


Ok.

t4(10, 20) = t5(10, 20)
true

t4(10, 20) < t5(10, 20)
false

t4(10, 20) < t5(10, 30)
true

Hugh Darwen

Re: Type-incompatible comparisons accepted

Posted: Mon Jun 23, 2014 1:53 pm
by Dave
Thanks for noting these - I've added them to my to-do list.