Skip to content

Commit

Permalink
<bugfix> proper error exception for tuple assignment of managed varia…
Browse files Browse the repository at this point in the history
…bles. see test fails/raii-tuple-custom-copy.t
  • Loading branch information
hiemstar committed May 27, 2024
1 parent f4caa8b commit 25cb501
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/terralib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3368,7 +3368,7 @@ function typecheck(topexp,luaenv,simultaneousdefinitions)
--assignment. So we prohibit assignments that may involve something
--like a swap: u,v = v, u.
--for now we prohibit this by limiting such assignments
erroratlocation(anchor, "a custom __copy assignment is not supported for tuples.")
diag:reporterror(anchor, "a custom __copy assignment is not supported for tuples.")
end
return regular, byfcall
end
Expand Down
8 changes: 1 addition & 7 deletions tests/fails/raii-tuple-custom-copy.t
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
if not require("fail") then return end
require "terralibext" --load 'terralibext' to enable raii

local std = {}
std.io = terralib.includec("stdio.h")

local function printtestheader(s)
print()
print("===========================")
print(s)
print("===========================")
end

struct A{
data : int
Expand All @@ -29,7 +24,6 @@ A.methods.__copy = terra(from : &A, to : &A)
to.data = from.data+1
end

printtestheader("raii.t - testing custom copy for tuples")
terra test0()
var a = A{1}
var b = A{2}
Expand Down

0 comments on commit 25cb501

Please sign in to comment.