You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The guarded semantics doesn't allow certain values as Dyn (inside a list).
from retic import List
class A:
def f(a:A, b:A)->List(A):
return [a, b]
class B:
vals = [A(), A()]
def g(self: B):
[a1, a2] = (self.vals[0]).f(self.vals[1])
b = B()
b.g()
Traceback
Traceback (most recent call last):
File "/usr/local/bin/retic", line 5, in <module>
retic.main()
File "/home/ben/code/gradual/reticulated/retic/retic.py", line 149, in main
reticulate(program, prog_args=args.args.split(), flag_sets=args)
File "/home/ben/code/gradual/reticulated/retic/retic.py", line 98, in reticulate
utils.handle_runtime_error(exit=True)
File "/home/ben/code/gradual/reticulated/retic/retic.py", line 96, in reticulate
_exec(code, __main__.__dict__)
File "/home/ben/code/gradual/reticulated/retic/exec3/__init__.py", line 2, in _exec
exec (obj, globs, locs)
File "bug-expected-tuple.py", line 15, in <module>
b.g()
File "/home/ben/code/gradual/reticulated/retic/rproxy.py", line 326, in __call__
return self.__call__(*args, **kwds)
File "/home/ben/code/gradual/reticulated/retic/guarded.py", line 208, in wrapper
else: ret = val(*cargs, **ckwds)
File "bug-expected-tuple.py", line 12, in g
[a1, a2] = (self.vals[0]).f(self.vals[1])
File "/home/ben/code/gradual/reticulated/retic/guarded.py", line 60, in retic_cast
return retic_cast(val, rtypes.Record({}), trg.structure(), msg, line)
File "/home/ben/code/gradual/reticulated/retic/guarded.py", line 75, in retic_cast
retic_assert(hasattr(val, m), val,msg, exc=ObjectTypeAttributeCastError)
File "/home/ben/code/gradual/reticulated/retic/guarded.py", line 35, in retic_assert
raise exc(msg % val)
retic.guarded.ObjectTypeAttributeCastError:
bug-expected-tuple.py:12:8: Right hand side of assignment was expected to be of type Tuple(Dyn,Dyn), but value [<__main__.A object at 0x7fa2b3baa128>, <__main__.A object at 0x7fa2b4323940>] provided instead. (code SINGLE_ASSIGN_ERROR)
The text was updated successfully, but these errors were encountered:
Thanks. This actually looks like a bug in how multiple assignment works; it casts the RHS to a tuple type to make sure it has the correct length but there's a bug in how I do list => tuple casts that leads to this error.
(FYI, Reticulated's implementations of guarded and monotonic are somewhat on the back burner right now compared to transient, so I might not fix these as quickly as I otherwise would. But I'll get to them as soon as possible and I appreciate the reports!)
The guarded semantics doesn't allow certain values as Dyn (inside a list).
Traceback
The text was updated successfully, but these errors were encountered: