Skip to content

Missing multiadic Boolean == #2131

Open
@rebcabin

Description

@rebcabin

VE:

from lpython import (i8, i32, i64, f32, f64,
                     dataclass
                     )
from numpy import (empty,
                   int8,
                   )

r : i8 = i8(240)

@dataclass
class Foo:
    a : i8[4] = empty(4, dtype=int8)
    dim : i32 = 4

def trinary_majority(x : Foo, y : Foo, z : Foo) -> Foo:
    foo : Foo = Foo()

    assert foo.dim == x.dim == y.dim == z.dim

    i : i32
    for i in range(foo.dim):
        pass


    # Issue 2130
    # foo.a = x.a | y.a | z.a
    return foo


t1 : Foo = Foo()
t1.a = empty(4, dtype=int8)

t2 : Foo = Foo()
t2.a = empty(4, dtype=int8)

t3 : Foo = Foo()
t3.a = empty(4, dtype=int8)

r1 : Foo = trinary_majority(t1, t2, t3)

runs:

(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)─────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(11:39:11 on brian-lasr ✹ ✭)──> ~/CLionProjects/lpython/src/bin/lpython -I. issue2126.py                                                            1 ↵ ──(Sun,Jul09)─┘
semantic error: Type mismatch in comparison operator, the types must be compatible
  --> issue2126.py:18:12
   |
18 |     assert foo.dim == x.dim == y.dim == z.dim
   |            ^^^^^^^^^^^^^^^^    ^^^^^ type mismatch ('bool' and 'i32')


Note: if any of the above error or warning messages are not clear or are lacking
context please report it to us (we consider that a bug that must be fixed).
(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)─────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(11:39:26 on brian-lasr ✹ ✭)──> PYTHONPATH='../../src/runtime/lpython' python issue2126.py

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions