Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Check if expression can be added to a block #685

Merged
merged 10 commits into from
Apr 4, 2023
135 changes: 15 additions & 120 deletions aqua-src/antithesis.aqua
Original file line number Diff line number Diff line change
@@ -1,120 +1,15 @@
aqua FooBars declares getObjAssign

export getObjAssign

data Record:
relay_id: []string
peer_id: string

-- func bugLng79(arr: *Record) -> u32:
-- stream: *Record
-- for r <- arr:
-- stream <<- r
-- someone = stream[0]
-- on someone.peer_id via someone.relay_id:
-- a = 1 + 1
-- <- a

service Op1("op"):
array_length(array: []string) -> u32
noop()
identity(s: *string) -> []string
--
-- func bugLNG63_3() -> string, u32, []u32:
-- status: *string
-- status <<- "ok"
-- stat = status!
-- num: *u32
-- num <<- 2
-- res = [Op1.array_length(status), num!]
-- <- status!, Op1.array_length(status), [Op1.array_length(status), 3, num!]

-- func emptySugar() -> *string:
-- strEmptyStream: *string
-- <- strEmptyStream

service Ser("ser"):
getRecord: -> Record

-- func bugLng79(log: string -> ()) -> u32:
-- stream: *Record
-- stream <- Ser.getRecord()
-- someone = stream[0]
-- on someone.peer_id via someone.relay_id:
-- a = 1 + 1
-- <- a

-- func streamAssignment(arr: []string) -> string:
-- stream: *[]u32
-- stream <<- [0]
-- a = stream[arr.length - 1][0]
-- b = arr[a]
-- <- b

-- func streamIntFunctor(arr: []u32) -> string:
-- stream: *[]string
-- stream <<- ["123"]
-- a = stream[arr[0]][arr[0]]
-- ap-prop = arr[0]
-- ap-prop inline: ap arr[0] ap-prop
-- *stream
-- gate
-- canon *stream -> #stream_canon_result
-- ap #stream_canon_result[ap-prop] -> result

-- <- a

-- service Op2("op"):
-- identity(s: u64)

-- func getTwoResults(node: string) -> []u64:
-- res: *u64
-- Op2.identity(res!)
-- Op2.identity(res!1)
-- Op2.identity(res!2)
-- <- res

data InnerObj:
arr: []string
num: u32

data SomeObj:
str: string
num: u64
inner: InnerObj

-- func wait(i: []u32) -> SomeObj:
-- obj = SomeObj(str = "some str",
-- num = 4,
-- inner = InnerObj(arr = ["a", "b", "c"], num = i[2])
-- )
-- <- obj.copy(str = "ululu")

-- func a(nums: []u32) -> []u32:
-- <- nums
--
-- func some():
-- a([1,2,3,4])

func getObjAssign(arr: []string) -> string:
streamJ: *[]string
streamJ <<- ["111", "222"]
streamJ <<- ["333", "444"]
<- streamJ[arr.length][1]


-- func getObjAssign(arr: []string) -> string:
-- stream: *[]u32
-- stream <<- [0]
-- a = stream[arr.length - 1][0]
-- b = arr[a]
-- <- b
-- func getObjAssign() -> SomeObj, SomeObj, u32:
-- obj = SomeObj(str = "first str",
-- num = 5,
-- inner = InnerObj(arr = ["d", "e", "f"], num = 5)
-- )
-- copiedObj = obj.copy(str = "some str", inner = obj.inner.copy(arr = ["a", "b", "c"])).copy(num = 6)
-- <- obj, copiedObj, copiedObj.inner.copy(arr = ["g"]).arr.length


service Console("run-console"):
print(any: ⊤)
get() -> string
zzz() -> string

data Azazaz:
s: string

func exec(peers: []string) -> []string:
on "":
closure = (s: Azazaz) -> Azazaz:
Console.get()
<- s
Console.zzz()
<- peers
Loading