zeolite-lang 0.20.0.0 → 0.20.0.1
raw patch · 4 files changed
+38/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +8/−0
- src/CompilerCxx/Procedure.hs +5/−3
- tests/function-calls.0rt +24/−0
- zeolite-lang.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,13 @@ # Revision history for zeolite-lang +## 0.20.0.1 -- 2021-11-14++### Language++* **[fix]** Fixes a regression where arguments ignored with `_` were not skipped+ over when generating C++. For example, `call (_,x) { ... }` would result in+ `x` being assigned the value that should have been ignored.+ ## 0.20.0.0 -- 2021-11-13 ### Language
src/CompilerCxx/Procedure.hs view
@@ -152,9 +152,11 @@ | otherwise = ["ReturnTuple returns(" ++ show (length $ pValues rs1) ++ ");"] nameParams = flip map (zip ([0..] :: [Int]) $ pValues ps1) $ (\(i,p2) -> paramType ++ " " ++ paramName (vpParam p2) ++ " = params.At(" ++ show i ++ ");")- nameArgs = flip map (zip ([0..] :: [Int]) $ filter (not . isDiscardedInput . snd) $ zip (pValues as1) (pValues $ avNames as2)) $- (\(i,(t2,n2)) -> "const " ++ variableProxyType (pvType t2) ++ " " ++ variableName (ivName n2) ++- " = " ++ writeStoredVariable (pvType t2) (UnwrappedSingle $ "args.At(" ++ show i ++ ")") ++ ";")+ nameArgs = map nameSingleArg (zip ([0..] :: [Int]) $ zip (pValues as1) (pValues $ avNames as2))+ nameSingleArg (i,(t2,n2))+ | isDiscardedInput n2 = "// Arg " ++ show i ++ " (" ++ show (pvType t2) ++ ") is discarded"+ | otherwise = "const " ++ variableProxyType (pvType t2) ++ " " ++ variableName (ivName n2) +++ " = " ++ writeStoredVariable (pvType t2) (UnwrappedSingle $ "args.At(" ++ show i ++ ")") ++ ";" nameReturns | isUnnamedReturns rs2 = [] | otherwise = map (\(i,(t2,n2)) -> nameReturn i (pvType t2) n2) (zip ([0..] :: [Int]) $ zip (pValues rs1) (pValues $ nrNames rs2))
tests/function-calls.0rt view
@@ -712,3 +712,27 @@ \ #x.execute() } }+++testcase "discarded args are skipped over" {+ success+}++unittest test {+ \ Testing.checkEquals<?>(Value.create().call(1,"mess",2,"age"),"message")+}++concrete Value {+ @type create () -> (Value)+ @value call (Int,String,any,Formatted) -> (String)+}++define Value {+ create () {+ return Value{}+ }++ call (_,x,_,y) {+ return x+y.formatted()+ }+}
zeolite-lang.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: zeolite-lang-version: 0.20.0.0+version: 0.20.0.1 synopsis: Zeolite is a statically-typed, general-purpose programming language. description: