hydra-java 0.17.5 → 0.17.6
raw patch · 14 files changed
+277/−102 lines, 14 filesdep ~hydra-jvmdep ~hydra-kernelPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hydra-jvm, hydra-kernel
API changes (from Hackage documentation)
Files
- CHANGELOG.md +162/−0
- hydra-java.cabal +4/−4
- src/main/haskell/Hydra/Dsl/Java/Environment.hs +1/−0
- src/main/haskell/Hydra/Dsl/Java/Language.hs +1/−0
- src/main/haskell/Hydra/Dsl/Java/Syntax.hs +1/−0
- src/main/haskell/Hydra/Gradle.hs +1/−0
- src/main/haskell/Hydra/Java/Coder.hs +66/−64
- src/main/haskell/Hydra/Java/Environment.hs +1/−0
- src/main/haskell/Hydra/Java/Language.hs +1/−0
- src/main/haskell/Hydra/Java/Names.hs +1/−0
- src/main/haskell/Hydra/Java/Serde.hs +32/−31
- src/main/haskell/Hydra/Java/Syntax.hs +1/−0
- src/main/haskell/Hydra/Java/Testing.hs +2/−1
- src/main/haskell/Hydra/Java/Utils.hs +3/−2
CHANGELOG.md view
@@ -15,6 +15,168 @@ --- +## [0.17.6] - 2026-08-30++Point release on the 0.17.x line, and the last backward-incompatible batch before the 1.0 surface+freeze. Five kernel-surface changes land together as the "0.17 breaking batch":+`null` becomes `isEmpty`, `read*`/`show*` become `parse*`/`print*`, `TypeScheme.constraints` and+`TypeVariableConstraints.classes` change shape, and the constructor primitives are finalized.+Alongside them, a genuine soundness gap in type inference is fixed — class constraints now propagate+through function-domain positions — and the cold-seed path is rebuilt on the Java host so that+breaking core-type changes are no longer structurally impossible to bootstrap.++**Backward-incompatible.** All five surface changes below alter the published kernel. Code written+against 0.17.5 must be updated:++- **[#682]** `hydra.lib.{lists,sets,maps,strings}.null` -> `.isEmpty`.+- **[#691]** the `read*`/`show*` family -> `parse*`/`print*`.+- **[#683]** `TypeScheme.constraints`: `optional<map>` -> plain `map`.+- **[#685]** `TypeVariableConstraints.classes`: `list` -> `set`.+- **[#687]** constructor primitives finalized: `lists.pure` is removed; `optionals.given`,+ `eithers.left`/`right` and `pairs.pair` are added.++[#682]: https://github.com/CategoricalData/hydra/issues/682+[#683]: https://github.com/CategoricalData/hydra/issues/683+[#685]: https://github.com/CategoricalData/hydra/issues/685+[#687]: https://github.com/CategoricalData/hydra/issues/687+[#691]: https://github.com/CategoricalData/hydra/issues/691++### Highlights++- **Class constraints propagate through contravariant positions**+ ([#702](https://github.com/CategoricalData/hydra/issues/702)): inference silently dropped a class+ constraint when the constrained type variable was bound through the **domain** (input) position of a+ higher-order function argument, while transferring it correctly in output positions — a real soundness+ gap in the type checker. It had been papered over twice by freezing `encodeMap`/`encodeSet` to+ monomorphic `Int`. Both freezes and the [#554](https://github.com/CategoricalData/hydra/issues/554)+ `toPrimitive` stopgap are now removed, the definitions re-polymorphized, and a domain-position+ regression test added. A `sets.filter` overlay lands across Java, Python, Scala, TypeScript and the+ Lisp dialects as its first consumer.+- **Cold-seed rebuilt on the Java host**+ ([#703](https://github.com/CategoricalData/hydra/issues/703)): CI's cold-seed steps compiled HEAD's+ kernel `Types` source against the *published* Hackage `hydra-kernel`, which is sound only for additive+ changes and structurally impossible for any breaking core-type-shape change — the root of a recurring+ red-CI class (#500, #608, #617, #417, #683). The Haskell cold-seeder (`ColdSeedMain`, `typesmods/`,+ Check-2) is deleted and replaced by a data-driven Java-host schema-walking seed+ (`seed-dist-haskell.sh`), which decodes `dist/json` and emits Haskell text without ever linking+ HEAD types against a published kernel.+- **`hydra.paths` completed** ([#716](https://github.com/CategoricalData/hydra/issues/716)):+ the step unions are realigned with the `hydra.core` term and type grammars — missing variants+ added (`annotatedAnnotation`, `eitherLeft`/`eitherRight`, `effect`), undirected steps given a+ direction, and variants named after retired constructors renamed. `hydra.print.paths` is rewritten+ as serialization-only (printers, parsers and a round-trip law), and the graph view moves to a new+ `hydra.shredding` module (`shredGraph`/`shredTerm`/`shredSchema`), which the Graphviz coder now+ consumes.+- **`hydra.lib.ordering` is genuinely structural on every host**+ ([#718](https://github.com/CategoricalData/hydra/issues/718)): the Java, Python and Scala overlay+ implementations fell back to comparing *printed strings* for non-literal and mixed-variant terms,+ contradicting the normative `ordering-and-equality.md` (records field-by-field in declaration+ order, unions by declared-variant order then payload, wrappers by wrapped value, decimals by+ numeric value then scale — with no print-based fallback anywhere). All three are now structural;+ Java delegates to the generated `compareTo`.+- **Bash driver-layer audit** ([#714](https://github.com/CategoricalData/hydra/issues/714)):+ a prerequisite to the remaining #416 promotion. Six dead build scripts superseded by+ `transform-json-to-target.sh` are deleted, and the #608 oil-and-water and #540 header-idempotency+ regression harnesses are wired into `test-regressions.sh`.++- **Backward-compatibility and deprecation policy**+ ([#676](https://github.com/CategoricalData/hydra/issues/676)): adds the normative spec chapter defining+ what "compatible" means after 1.0 — the additivity calculus, the deprecation/rename mechanism, and+ enforcement. `LifecycleInfo.deprecatedSince` moves from defined-but-unused to populated on **32**+ kernel primitives slated for 0.18 deprecation, via a new `deprecatedSince` DSL helper.+- **Effect-sequencing contract specified and tested**+ ([#675](https://github.com/CategoricalData/hydra/issues/675)): `hydra.lib.effects` carries a sequencing+ contract — effects composed in a specified order, exactly once each, with `bind`'s continuation deferred+ until the prior effect has run. On the lazy Haskell host this falls out of the evaluation model; on the+ eight eager hosts it depended entirely on each hand-written interpreter. The obligations are now written+ into `effects.md` and backed by ordering-observation tests for `bind`/`foldList`/`mapList`/`mapOptional`.+- **Non-GC memory-discipline investigation**+ ([#678](https://github.com/CategoricalData/hydra/issues/678)): Hydra's data model says nothing about+ allocation, freeing, or ownership, which is what gates Swift, Rust, C++ and C as runtime hosts. This+ investigation delivers per-language verdicts plus leak-free proof-of-concept implementations — Rust+ (`Box` structural ownership), C++ (`unique_ptr` + arena) and C (arena), all ASan/LSan-clean on+ construct-and-drop of a recursive `Term` — and an airtight analysis of Swift's class-forcing requirement.+- **Build system promotion continues** ([#416](https://github.com/CategoricalData/hydra/issues/416)):+ adds `hydra.build.Registry`, which models per-language build identity as data (name / coder package /+ family) with per-script scope lists. `syncMatrix` and `langExpansion` are rewired onto it, and the+ hardcoded language lists in the test and bench scripts are retired in favour of a generated+ `languages.json`. Later in the cycle: `publishsets.reverseDepClosure` and+ `publishsets.requiresCoders` promote reverse-dependency propagation and per-package coder-loading+ into data, an `expected-libraries.json` artifact lets the Common Lisp and Emacs Lisp harnesses+ fail fast on a missing `hydra.lib`, and a host-independent `apply-assembly-plan.sh` executor+ (with a conformance test) takes over the Java `assemble-distribution` Step 0.+- **Serialization specification chapter**+ ([#674](https://github.com/CategoricalData/hydra/issues/674)): documents serializability, the+ encode/decode contract, and the round-trip law; `isSerializable` now forbids `void`+ ([#690](https://github.com/CategoricalData/hydra/issues/690)), and `hydra.lib.functions.absurd` is added+ as the void eliminator ([#684](https://github.com/CategoricalData/hydra/issues/684)).++### Bug fixes++- **Hoisting silently produced terms with free variables**+ ([#717](https://github.com/CategoricalData/hydra/issues/717)):+ `augmentBindingsWithNewFreeVars` returned a binding *unchanged* when a captured variable had no+ type in the context, yielding a top-level binding with free variables — a term valid before+ hoisting and invalid after, produced with no error. It is now total and fails loudly, per the+ kernel's fail-immediately rule.+- **TypeScript `div`/`mod` used truncating semantics**+ ([#677](https://github.com/CategoricalData/hydra/issues/677)): corrected to floor/Knuth division via+ shared bigint helpers, with an `Optional` codomain; the dead `maybeDiv`/`maybeMod` are deleted and an+ emitted-path test added.+- **Overlay lag behind the `null` -> `isEmpty` rename**+ ([#682](https://github.com/CategoricalData/hydra/issues/682)): the Java, Python, Scala, TypeScript and+ Lisp overlays each kept a stale spelling (`isEmpty_`, a half-renamed Python `null` impl, and Lisp+ camelCase where the coder emits snake_case), breaking generation until reconciled.+- **`check-haskell-def-completeness` could not resolve qualified assembly references**+ ([#683](https://github.com/CategoricalData/hydra/issues/683)), surfaced once the #703 cold-clone path+ began reaching the check.+- **Void-typed definitions leaked into DSL-ref generation**+ ([#684](https://github.com/CategoricalData/hydra/issues/684)): `absurd` and friends are now excluded+ across all hosts.+- **Scheme bootstrap loader gaps** ([#641](https://github.com/CategoricalData/hydra/issues/641)):+ missing `functions.scm`/`ordering.scm` in the native-lib load list, missing defaults in the def-module+ load list, and a guile-only import allowlist.+- **Bootstrap diff detail was swallowed** ([#671](https://github.com/CategoricalData/hydra/issues/671)):+ now persisted to `<run>/<path>.diff`, with `compare_output`'s return value no longer discarded.+ Separately, `compare_output` mis-derived the `src/main` vs `src/test` root per file+ ([#706](https://github.com/CategoricalData/hydra/issues/706)).+- **Nested duplicate output path** ([#664](https://github.com/CategoricalData/hydra/issues/664)) from+ `hydra-kernel` being hardcoded into `defaultOutput`.+- **Bootstrap codegen exceptions hid their stack traces**+ ([#707](https://github.com/CategoricalData/hydra/issues/707)) in `bootstrap.ts`.++### Release tooling++- `bin/check-release-env.sh` ([#704](https://github.com/CategoricalData/hydra/issues/704)) adds a+ publish-time toolchain preflight, after JDK- and twine-version problems cost real time at 0.17.5.+- The TypeScript head's node floor is lowered to `^18.0.0 || >=20.0.0`, the true vitest constraint+ ([#708](https://github.com/CategoricalData/hydra/issues/708)).+- Hydra does not create GitHub Releases; the detached `.asc` signature stays in `release-artifacts/`+ until [#441](https://github.com/CategoricalData/hydra/issues/441)+ ([#508](https://github.com/CategoricalData/hydra/issues/508)).++### Known issues++- The `hostOverrides` shim is pinned to `{java: local, python: local}` for the duration of the breaking+ batch, since the new kernel surface is by definition absent from published 0.17.5. It must be retired+ once 0.17.6 is visible in Maven Central and PyPI+ ([#508](https://github.com/CategoricalData/hydra/issues/508)).+- **`hydra-ext` does not ship to Maven Central for Java**, as in 0.17.4 and 0.17.5: the Java coder's+ visitor-pattern inner interface still collides with an enclosing type named `Visitor`+ ([#643](https://github.com/CategoricalData/hydra/issues/643)), so the package does not compile for+ that target. It publishes to Hackage and PyPI as usual.+- The breaking batch leaves three deliberate 0.18 tails, each separately tracked:+ `effects.pure` is retained provisionally pending a name decision+ ([#688](https://github.com/CategoricalData/hydra/issues/688)); the `printable` type class that would+ promote the print/parse convention into enforced dispatch awaits+ [#497](https://github.com/CategoricalData/hydra/issues/497); and the literal conversion lattice is+ gated on [#129](https://github.com/CategoricalData/hydra/issues/129) via+ [#689](https://github.com/CategoricalData/hydra/issues/689). Anticipated `TypeClassConstraint`+ variants remain open as [#686](https://github.com/CategoricalData/hydra/issues/686) — the `set`+ element type must stay orderable as variants are added.++---+ ## [0.17.5] - 2026-08-19 Point release on the 0.17.x line. Two language-surface changes lead: sum-type eliminators unify on
hydra-java.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.38.1.+-- This file has been generated from package.yaml by hpack version 0.39.1. -- -- see: https://github.com/sol/hpack name: hydra-java-version: 0.17.5+version: 0.17.6 synopsis: Hydra's Java coder: emit Java source from Hydra modules description: Hydra is an implementation of the LambdaGraph data model, which takes advantage of an isomorphism between labeled hypergraphs and typed lambda calculus: in Hydra, "graphs are programs, and programs are graphs". Java support for Hydra category: Data@@ -46,7 +46,7 @@ build-depends: base >=4.19.0 && <4.22 , containers >=0.6.7 && <0.8- , hydra-jvm ==0.17.5- , hydra-kernel ==0.17.5+ , hydra-jvm ==0.17.6+ , hydra-kernel ==0.17.6 , scientific >=0.3.7 && <0.4 default-language: Haskell2010
src/main/haskell/Hydra/Dsl/Java/Environment.hs view
@@ -14,6 +14,7 @@ import qualified Hydra.Typing as Typing import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void import qualified Data.Map as M import qualified Data.Set as S
src/main/haskell/Hydra/Dsl/Java/Language.hs view
@@ -31,6 +31,7 @@ import qualified Hydra.Variants as Variants import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void import qualified Data.Set as S -- | DSL reference to hydra.java.language.javaLanguage
src/main/haskell/Hydra/Dsl/Java/Syntax.hs view
@@ -9,6 +9,7 @@ import qualified Hydra.Typed as Typed import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void -- | DSL constructor for the hydra.java.syntax.AdditionalBound wrapper additionalBound :: Typed.TypedTerm Syntax.InterfaceType -> Typed.TypedTerm Syntax.AdditionalBound
src/main/haskell/Hydra/Gradle.hs view
@@ -9,6 +9,7 @@ import qualified Hydra.Packaging as Packaging import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void -- | Configuration for the Gradle antlr plugin's grammar generation (generateGrammarSource). data AntlrConfig =
src/main/haskell/Hydra/Java/Coder.hs view
@@ -71,6 +71,7 @@ import qualified Hydra.Variants as Variants import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void import qualified Data.Map as M import qualified Data.Set as S @@ -104,11 +105,11 @@ annotateLambdaArgs :: Core.Name -> [Core.Type] -> [Core.Term] -> t0 -> Graph.Graph -> Either t1 [Core.Term] annotateLambdaArgs cname tApps argTerms cx g =- Logic.ifElse (Lists.null tApps) (Right argTerms) (Eithers.bind (Eithers.bind (Right (Lexical.lookupBinding g cname)) (\mel -> Optionals.match mel (Right (Optionals.map (\prim -> Scoping.termSignatureToTypeScheme (Packaging.primitiveDefinitionSignature (Graph.primitiveDefinition prim))) (Maps.lookup cname (Graph.graphPrimitives g)))) (\el -> Right (Core.bindingTypeScheme el)))) (\mts -> Optionals.match mts (Right argTerms) (\ts ->+ Logic.ifElse (Lists.isEmpty tApps) (Right argTerms) (Eithers.bind (Eithers.bind (Right (Lexical.lookupBinding g cname)) (\mel -> Optionals.match mel (Right (Optionals.map (\prim -> Scoping.termSignatureToTypeScheme (Packaging.primitiveDefinitionSignature (Graph.primitiveDefinition prim))) (Maps.lookup cname (Graph.graphPrimitives g)))) (\el -> Right (Core.bindingTypeScheme el)))) (\mts -> Optionals.match mts (Right argTerms) (\ts -> let schemeType = Core.typeSchemeBody ts schemeTypeVars = collectTypeVars schemeType schemeVars = Lists.filter (\v -> Sets.member v schemeTypeVars) (Core.typeSchemeVariables ts)- in (Logic.ifElse (Logic.or (Lists.null schemeVars) (Logic.not (Equality.equal (Lists.length schemeVars) (Lists.length tApps)))) (Right argTerms) (+ in (Logic.ifElse (Logic.or (Lists.isEmpty schemeVars) (Logic.not (Equality.equal (Lists.length schemeVars) (Lists.length tApps)))) (Right argTerms) ( let subst = Maps.fromList (Lists.zip schemeVars tApps) expectedTypes = peelExpectedTypes subst (Lists.length argTerms) schemeType in (Right (Lists.zipWith (\arg -> \mExpected -> propagateType mExpected arg) argTerms (Lists.concat2 expectedTypes (Lists.replicate (Lists.length argTerms) (Core.TypeVariable (Core.Name "unused")))))))))))@@ -121,7 +122,8 @@ castVars = collectTypeVars castType javaTypeVars = Sets.fromList (Lists.filter (\v -> Logic.or (Sets.member v inScope) (isLambdaBoundVariable v)) (Sets.toList castVars))- isSafe = Logic.or (Sets.null trusted) (Logic.or (Sets.null javaTypeVars) (Sets.null (Sets.difference javaTypeVars trusted)))+ isSafe =+ Logic.or (Sets.isEmpty trusted) (Logic.or (Sets.isEmpty javaTypeVars) (Sets.isEmpty (Sets.difference javaTypeVars trusted))) in (Logic.ifElse isSafe (Eithers.bind (encodeType aliases Sets.empty castType cx g) (\jtype -> Eithers.bind (Utils.javaTypeToJavaReferenceType jtype cx) (\rt -> Right (Utils.javaCastExpressionToJavaExpression (Utils.javaCastExpression rt (Utils.javaExpressionToJavaUnaryExpression expr)))))) (Right expr)) applyJavaArg :: Syntax.Expression -> Syntax.Expression -> Syntax.Expression@@ -345,7 +347,7 @@ JavaEnvironment.JavaEnvironment { JavaEnvironment.javaEnvironmentAliases = aliasesExtended, JavaEnvironment.javaEnvironmentGraph = gExtended}- in (Logic.ifElse (Lists.null bindings) (Right ([], envExtended)) (Eithers.bind (Eithers.mapList (\names -> Eithers.bind (Eithers.mapList (\n -> toDeclInit aliasesExtended gExtended recursiveVars flatBindings n cx g) names) (\inits -> Eithers.bind (Eithers.mapList (\n -> toDeclStatement envExtended aliasesExtended gExtended recursiveVars thunkedVars flatBindings n cx g) names) (\decls -> Right (Lists.concat2 (Optionals.givens inits) decls)))) sorted) (\groups -> Right (Lists.concat groups, envExtended))))+ in (Logic.ifElse (Lists.isEmpty bindings) (Right ([], envExtended)) (Eithers.bind (Eithers.mapList (\names -> Eithers.bind (Eithers.mapList (\n -> toDeclInit aliasesExtended gExtended recursiveVars flatBindings n cx g) names) (\inits -> Eithers.bind (Eithers.mapList (\n -> toDeclStatement envExtended aliasesExtended gExtended recursiveVars thunkedVars flatBindings n cx g) names) (\decls -> Right (Lists.concat2 (Optionals.givens inits) decls)))) sorted) (\groups -> Right (Lists.concat groups, envExtended)))) boundTypeVariables :: Core.Type -> [Core.Name] boundTypeVariables typ =@@ -506,7 +508,7 @@ Logic.ifElse (Dependencies.isLambda term) ( let n = classifyDataTerm_countLambdaParams term in (Logic.ifElse (Ordering.gt n 1) (JavaEnvironment.JavaSymbolClassHoistedLambda n) JavaEnvironment.JavaSymbolClassUnaryFunction)) (- let hasTypeParams = Logic.not (Lists.null (Core.typeSchemeVariables ts))+ let hasTypeParams = Logic.not (Lists.isEmpty (Core.typeSchemeVariables ts)) in (Logic.ifElse hasTypeParams ( let n2 = classifyDataTerm_countLambdaParams (classifyDataTerm_stripTypeLambdas term) in (Logic.ifElse (Ordering.gt n2 0) (JavaEnvironment.JavaSymbolClassHoistedLambda n2) JavaEnvironment.JavaSymbolClassNullaryFunction)) JavaEnvironment.JavaSymbolClassNullaryFunction))@@ -588,7 +590,7 @@ collectionTypeArgs :: String -> Int -> JavaEnvironment.Aliases -> [M.Map Core.Name Core.Term] -> [Syntax.Type] -> t0 -> Graph.Graph -> Either Errors.Error [Syntax.TypeArgument] collectionTypeArgs label n aliases anns tyapps cx g =- Logic.ifElse (Logic.not (Lists.null tyapps)) (takeTypeArgs label n tyapps cx g) (+ Logic.ifElse (Logic.not (Lists.isEmpty tyapps)) (takeTypeArgs label n tyapps cx g) ( let combinedAnns = Lists.foldl (\acc -> \m -> Maps.union acc m) Maps.empty anns in (Eithers.bind (Eithers.bimap (\_de -> Errors.ErrorOther (Errors.OtherError (Errors.unDecodingError _de))) (\_a -> _a) (Annotations.getType g combinedAnns)) (\mtyp -> Eithers.bind (Optionals.match mtyp (Right []) (\typ -> case (Strip.deannotateType typ) of Core.TypeList v0 -> Right [@@ -639,7 +641,7 @@ in (Optionals.withDefault zeroStmts (Optionals.map (\p -> let firstField = Pairs.first p restFields = Pairs.second p- in (Logic.ifElse (Lists.null restFields) [+ in (Logic.ifElse (Lists.isEmpty restFields) [ Syntax.BlockStatementStatement (Utils.javaReturnStatement (Just (compareFieldExpr otherVar firstField)))] (Lists.concat2 [ cmpDeclStatement aliases] (Lists.concat2 (Lists.concat (Lists.map (\f -> compareAndReturnStmts otherVar f) (Lists.cons firstField (Optionals.withDefault [] (Lists.init restFields))))) [ Syntax.BlockStatementStatement (Utils.javaReturnStatement (Just (compareFieldExpr otherVar (Optionals.withDefault firstField (Lists.last restFields)))))])))) (Lists.uncons fields)))@@ -770,8 +772,8 @@ filteredFallback0 = Logic.ifElse (Equality.equal (Lists.length allSchemeVars) (Lists.length fallbackTypeApps)) (filterByFlags fallbackTypeApps keepFlags) fallbackTypeApps filteredFallback =- Logic.ifElse (Maps.null overgenSubst) filteredFallback0 (Lists.map (\t -> substituteTypeVarsWithTypes overgenSubst t) filteredFallback0)- in (Logic.ifElse (Logic.or (Lists.null schemeVars) (Logic.not (Equality.equal (Lists.length schemeVars) (Lists.length filteredFallback)))) (Right filteredFallback) (correctTypeAppsWithArgs schemeVars filteredFallback schemeType args cx g)))))+ Logic.ifElse (Maps.isEmpty overgenSubst) filteredFallback0 (Lists.map (\t -> substituteTypeVarsWithTypes overgenSubst t) filteredFallback0)+ in (Logic.ifElse (Logic.or (Lists.isEmpty schemeVars) (Logic.not (Equality.equal (Lists.length schemeVars) (Lists.length filteredFallback)))) (Right filteredFallback) (correctTypeAppsWithArgs schemeVars filteredFallback schemeType args cx g))))) correctTypeAppsWithArgs :: [Core.Name] -> [Core.Type] -> Core.Type -> [Core.Term] -> t0 -> Graph.Graph -> Either Errors.Error [Core.Type] correctTypeAppsWithArgs schemeVars fallbackTypeApps schemeType args cx g =@@ -780,11 +782,11 @@ irSubst = Maps.fromList (Lists.zip schemeVars fallbackTypeApps) peeled = peelDomainTypes (Lists.length args) schemeType schemeDoms = Pairs.first peeled- in (Eithers.bind (Eithers.mapList (\arg -> Eithers.bimap (\_de -> Errors.ErrorOther (Errors.OtherError (Errors.unDecodingError _de))) (\_a -> _a) (Annotations.getType g (Annotations.termAnnotationInternal arg))) args) (\mArgTypes -> Logic.ifElse (Logic.not (Lists.null (Lists.filter (\m -> Optionals.isNone m) mArgTypes))) (Right fallbackTypeApps) (- let argTypes = Lists.bind mArgTypes (\m -> Optionals.match m [] (\x -> Lists.pure x))+ in (Eithers.bind (Eithers.mapList (\arg -> Eithers.bimap (\_de -> Errors.ErrorOther (Errors.OtherError (Errors.unDecodingError _de))) (\_a -> _a) (Annotations.getType g (Annotations.termAnnotationInternal arg))) args) (\mArgTypes -> Logic.ifElse (Logic.not (Lists.isEmpty (Lists.filter (\m -> Optionals.isNone m) mArgTypes))) (Right fallbackTypeApps) (+ let argTypes = Lists.bind mArgTypes (\m -> Optionals.match m [] (\x -> Lists.singleton x)) irDoms = Lists.map (\d -> applySubstSimple irSubst d) schemeDoms domsMatch =- Lists.null (Lists.filter (\p -> Logic.not (typesMatch (Strip.deannotateType (Pairs.first p)) (Strip.deannotateType (Pairs.second p)))) (Lists.zip irDoms argTypes))+ Lists.isEmpty (Lists.filter (\p -> Logic.not (typesMatch (Strip.deannotateType (Pairs.first p)) (Strip.deannotateType (Pairs.second p)))) (Lists.zip irDoms argTypes)) in (Logic.ifElse domsMatch (Right fallbackTypeApps) (Right (resolveTypeApps schemeVars fallbackTypeApps (buildArgSubst schemeVarSet schemeDoms argTypes))))))) countFunctionParams :: Core.Type -> Int@@ -826,7 +828,7 @@ linkTargetStr, "}."] consComment =- Logic.ifElse (Lists.null nonEmptyParamLines) consBaseComment (Strings.concat [+ Logic.ifElse (Lists.isEmpty nonEmptyParamLines) consBaseComment (Strings.concat [ consBaseComment, "\n\n", (Strings.join "\n" nonEmptyParamLines)])@@ -1074,13 +1076,13 @@ nonSelfVars = Lists.filter (\v -> Logic.not (Equality.equal v inVar)) outVars safeNonSelfVars = Lists.filter (\v -> Logic.and (Logic.not (Sets.member v directInputVars)) (Logic.not (Equality.equal (Just v) codVar))) nonSelfVars- in (Logic.ifElse (Logic.and (Ordering.gte selfRefCount 2) (Logic.not (Lists.null safeNonSelfVars))) (Lists.foldl (\s -> \v -> Maps.insert v inVar s) subst safeNonSelfVars) subst)+ in (Logic.ifElse (Logic.and (Ordering.gte selfRefCount 2) (Logic.not (Lists.isEmpty safeNonSelfVars))) (Lists.foldl (\s -> \v -> Maps.insert v inVar s) subst safeNonSelfVars) subst) domTypeArgs :: JavaEnvironment.Aliases -> Core.Type -> t0 -> Graph.Graph -> Either Errors.Error [Syntax.TypeArgument] domTypeArgs aliases d cx g = let args = extractTypeApplicationArgs (Strip.deannotateType d)- in (Logic.ifElse (Logic.not (Lists.null args)) (Eithers.mapList (\t -> Eithers.bind (encodeType aliases Sets.empty t cx g) (\jt -> Eithers.bind (Utils.javaTypeToJavaReferenceType jt cx) (\rt -> Right (Syntax.TypeArgumentReference rt)))) args) (Right (javaTypeArgumentsForType d)))+ in (Logic.ifElse (Logic.not (Lists.isEmpty args)) (Eithers.mapList (\t -> Eithers.bind (encodeType aliases Sets.empty t cx g) (\jt -> Eithers.bind (Utils.javaTypeToJavaReferenceType jt cx) (\rt -> Right (Syntax.TypeArgumentReference rt)))) args) (Right (javaTypeArgumentsForType d))) elementJavaIdentifier :: Bool -> Bool -> JavaEnvironment.Aliases -> Core.Name -> Syntax.Identifier elementJavaIdentifier isPrim isMethod aliases name =@@ -1140,10 +1142,10 @@ trusted = JavaEnvironment.aliasesTrustedTypeVars aliases inScope = JavaEnvironment.aliasesInScopeTypeParams aliases filteredTypeApps =- Logic.ifElse (Logic.or (Sets.null trusted) (Sets.null inScope)) [] (+ Logic.ifElse (Logic.or (Sets.isEmpty trusted) (Sets.isEmpty inScope)) [] ( let allVars = Sets.unions (Lists.map (\t -> collectTypeVars t) typeApps)- in (Logic.ifElse (Logic.not (Sets.null (Sets.difference allVars inScope))) [] (Logic.ifElse (Sets.null (Sets.difference allVars trusted)) typeApps [])))- in (Eithers.bind (Logic.ifElse (Lists.null filteredTypeApps) (Right []) (correctTypeApps g v0 hargs filteredTypeApps cx g)) (\safeTypeApps -> Eithers.bind (filterPhantomTypeArgs v0 safeTypeApps cx g) (\finalTypeApps -> Eithers.bind (functionCall env False v0 hargs finalTypeApps cx g) (\initialCall -> Eithers.foldList (\acc -> \h -> Eithers.bind (encodeTerm env h cx g) (\jarg -> Right (applyJavaArg acc jarg))) initialCall rargs)))))))+ in (Logic.ifElse (Logic.not (Sets.isEmpty (Sets.difference allVars inScope))) [] (Logic.ifElse (Sets.isEmpty (Sets.difference allVars trusted)) typeApps [])))+ in (Eithers.bind (Logic.ifElse (Lists.isEmpty filteredTypeApps) (Right []) (correctTypeApps g v0 hargs filteredTypeApps cx g)) (\safeTypeApps -> Eithers.bind (filterPhantomTypeArgs v0 safeTypeApps cx g) (\finalTypeApps -> Eithers.bind (functionCall env False v0 hargs finalTypeApps cx g) (\initialCall -> Eithers.foldList (\acc -> \h -> Eithers.bind (encodeTerm env h cx g) (\jarg -> Right (applyJavaArg acc jarg))) initialCall rargs))))))) _ -> encodeApplication_fallback env aliases g typeApps (Core.applicationFunction app) (Core.applicationArgument app) cx g))))) encodeApplication_fallback :: JavaEnvironment.JavaEnvironment -> JavaEnvironment.Aliases -> Graph.Graph -> [Core.Type] -> Core.Term -> Core.Term -> Typing.InferenceContext -> Graph.Graph -> Either Errors.Error Syntax.Expression@@ -1155,7 +1157,7 @@ defaultExpr = \_bug438_dflt -> Eithers.bind (encodeTerm env lhs cx g) (\jfun -> Eithers.bind (encodeTerm env rhs cx g) (\jarg -> Right (applyJavaArg jfun jarg))) elimBranch =- \_bug438_elim -> Eithers.bind (encodeTerm env rhs cx g) (\jarg -> Eithers.bind (Logic.ifElse (Logic.not (Lists.null (javaTypeArgumentsForType dom))) (Right dom) (Eithers.bind (Eithers.bimap (\_de -> Errors.ErrorOther (Errors.OtherError (Errors.unDecodingError _de))) (\_a -> _a) (Annotations.getType g (Annotations.termAnnotationInternal rhs))) (\mrt -> Optionals.match mrt (Eithers.bind (Checking.typeOfTerm cx g rhs) (\rt -> Right (Logic.ifElse (Logic.not (Lists.null (javaTypeArgumentsForType rt))) rt dom))) (\rt -> Right (Logic.ifElse (Logic.not (Lists.null (javaTypeArgumentsForType rt))) rt dom))))) (\enrichedDom -> encodeElimination env (Just jarg) enrichedDom cod (Strip.deannotateTerm lhs) cx g))+ \_bug438_elim -> Eithers.bind (encodeTerm env rhs cx g) (\jarg -> Eithers.bind (Logic.ifElse (Logic.not (Lists.isEmpty (javaTypeArgumentsForType dom))) (Right dom) (Eithers.bind (Eithers.bimap (\_de -> Errors.ErrorOther (Errors.OtherError (Errors.unDecodingError _de))) (\_a -> _a) (Annotations.getType g (Annotations.termAnnotationInternal rhs))) (\mrt -> Optionals.match mrt (Eithers.bind (Checking.typeOfTerm cx g rhs) (\rt -> Right (Logic.ifElse (Logic.not (Lists.isEmpty (javaTypeArgumentsForType rt))) rt dom))) (\rt -> Right (Logic.ifElse (Logic.not (Lists.isEmpty (javaTypeArgumentsForType rt))) rt dom))))) (\enrichedDom -> encodeElimination env (Just jarg) enrichedDom cod (Strip.deannotateTerm lhs) cx g)) in case (Strip.deannotateAndDetypeTerm lhs) of Core.TermProject _ -> elimBranch () Core.TermCases _ -> elimBranch ()@@ -1179,7 +1181,7 @@ Lists.filter (\td -> let typ = Core.typeSchemeBody (Packaging.typeDefinitionBody td) in (isSerializableJavaType typ)) typeDefs- in (Eithers.bind (Eithers.mapList (\td -> encodeTypeDefinition pkg aliases td cx g) nonTypedefDefs) (\typeUnits -> Eithers.bind (Logic.ifElse (Lists.null termDefs) (Right []) (Eithers.bind (Eithers.mapList (\td -> encodeTermDefinition env td cx g) termDefs) (\dataMembers -> Right [+ in (Eithers.bind (Eithers.mapList (\td -> encodeTypeDefinition pkg aliases td cx g) nonTypedefDefs) (\typeUnits -> Eithers.bind (Logic.ifElse (Lists.isEmpty termDefs) (Right []) (Eithers.bind (Eithers.mapList (\td -> encodeTermDefinition env td cx g) termDefs) (\dataMembers -> Right [ constructElementsInterface mod dataMembers]))) (\termUnits -> Right (Maps.fromList (Lists.concat2 typeUnits termUnits))))) encodeElimination :: JavaEnvironment.JavaEnvironment -> Maybe Syntax.Expression -> Core.Type -> Core.Type -> Core.Term -> Typing.InferenceContext -> Graph.Graph -> Either Errors.Error Syntax.Expression@@ -1262,7 +1264,7 @@ env4 = Pairs.second bindResult in (Eithers.bind (encodeTerm env4 innerBody cx g) (\jbody -> let lam1 =- Logic.ifElse (Lists.null bindings) (Utils.javaLambda lambdaVar jbody) (+ Logic.ifElse (Lists.isEmpty bindings) (Utils.javaLambda lambdaVar jbody) ( let returnSt = Syntax.BlockStatementStatement (Utils.javaReturnStatement (Just jbody)) in (Utils.javaLambdaFromBlock lambdaVar (Syntax.Block (Lists.concat2 bindingStmts [ returnSt]))))@@ -1314,7 +1316,7 @@ className, "::", JavaNames.applyMethodName])))) (- let paramNames = Lists.map (\i -> Core.Name (Strings.concat2 "p" (Literals.showInt32 i))) (Math.range 0 arity)+ let paramNames = Lists.map (\i -> Core.Name (Strings.concat2 "p" (Literals.printInt32 i))) (Math.range 0 arity) paramExprs = Lists.map (\p -> Utils.javaIdentifierToJavaExpression (Utils.variableToJavaIdentifier p)) paramNames classId = Syntax.Identifier className call =@@ -1332,7 +1334,7 @@ in (Utils.javaArrayCreation Utils.javaBytePrimitiveType (Just (Utils.javaArrayInitializer (Lists.map (\w -> Utils.javaLiteralToJavaExpression (Syntax.LiteralInteger (Syntax.IntegerLiteral (Literals.int32ToBigint (Logic.ifElse (Ordering.gt w 127) (Math.sub w 256) w))))) byteValues)))) Core.LiteralBoolean v0 -> encodeLiteral_litExp (Utils.javaBoolean v0) Core.LiteralDecimal v0 -> Utils.javaConstructorCall (Utils.javaConstructorName (Syntax.Identifier "java.math.BigDecimal") Nothing) [- encodeLiteral (Core.LiteralString (Literals.showDecimal v0))] Nothing+ encodeLiteral (Core.LiteralString (Literals.printDecimal v0))] Nothing Core.LiteralFloat v0 -> encodeLiteral_encodeFloat v0 Core.LiteralInteger v0 -> encodeLiteral_encodeInteger v0 Core.LiteralString v0 -> encodeLiteral_litExp (Utils.javaString v0)@@ -1381,20 +1383,20 @@ encodeLiteral_encodeFloat32 :: Float -> Syntax.Expression encodeLiteral_encodeFloat32 v = - let s = Literals.showFloat32 v+ let s = Literals.printFloat32 v in (Logic.ifElse (Equality.equal s "NaN") (encodeLiteral_javaSpecialFloatExpr "Float" "NaN") (Logic.ifElse (Equality.equal s "Infinity") (encodeLiteral_javaSpecialFloatExpr "Float" "POSITIVE_INFINITY") (Logic.ifElse (Equality.equal s "-Infinity") (encodeLiteral_javaSpecialFloatExpr "Float" "NEGATIVE_INFINITY") (encodeLiteral_primCast (Syntax.PrimitiveTypeNumeric (Syntax.NumericTypeFloatingPoint Syntax.FloatingPointTypeFloat)) (encodeLiteral_litExp (Syntax.LiteralFloatingPoint (Syntax.FloatingPointLiteral (Literals.float32ToFloat64 v)))))))) encodeLiteral_encodeFloat64 :: Double -> Syntax.Expression encodeLiteral_encodeFloat64 v = - let s = Literals.showFloat64 v+ let s = Literals.printFloat64 v in (Logic.ifElse (Equality.equal s "NaN") (encodeLiteral_javaSpecialFloatExpr "Double" "NaN") (Logic.ifElse (Equality.equal s "Infinity") (encodeLiteral_javaSpecialFloatExpr "Double" "POSITIVE_INFINITY") (Logic.ifElse (Equality.equal s "-Infinity") (encodeLiteral_javaSpecialFloatExpr "Double" "NEGATIVE_INFINITY") (Logic.ifElse (Equality.equal s "-0.0") (encodeLiteral_javaParseDouble "-0.0") (encodeLiteral_litExp (Syntax.LiteralFloatingPoint (Syntax.FloatingPointLiteral v))))))) encodeLiteral_encodeInteger :: Core.IntegerValue -> Syntax.Expression encodeLiteral_encodeInteger i = case i of Core.IntegerValueBigint v0 -> Utils.javaConstructorCall (Utils.javaConstructorName (Syntax.Identifier "java.math.BigInteger") Nothing) [- encodeLiteral (Core.LiteralString (Literals.showBigint v0))] Nothing+ encodeLiteral (Core.LiteralString (Literals.printBigint v0))] Nothing Core.IntegerValueInt8 v0 -> encodeLiteral_primCast (Syntax.PrimitiveTypeNumeric (Syntax.NumericTypeIntegral Syntax.IntegralTypeByte)) (encodeLiteral_litExp (Syntax.LiteralInteger (Syntax.IntegerLiteral (Literals.int8ToBigint v0)))) Core.IntegerValueInt16 v0 -> encodeLiteral_primCast (Syntax.PrimitiveTypeNumeric (Syntax.NumericTypeIntegral Syntax.IntegralTypeShort)) (encodeLiteral_litExp (Syntax.LiteralInteger (Syntax.IntegerLiteral (Literals.int16ToBigint v0)))) Core.IntegerValueInt32 v0 -> encodeLiteral_litExp (Syntax.LiteralInteger (Syntax.IntegerLiteral (Literals.int32ToBigint v0)))@@ -1403,7 +1405,7 @@ Core.IntegerValueUint16 v0 -> encodeLiteral_litExp (Syntax.LiteralCharacter v0) Core.IntegerValueUint32 v0 -> encodeLiteral_primCast (Syntax.PrimitiveTypeNumeric (Syntax.NumericTypeIntegral Syntax.IntegralTypeLong)) (encodeLiteral_litExp (Syntax.LiteralInteger (Syntax.IntegerLiteral (Literals.uint32ToBigint v0)))) Core.IntegerValueUint64 v0 -> Utils.javaConstructorCall (Utils.javaConstructorName (Syntax.Identifier "java.math.BigInteger") Nothing) [- encodeLiteral (Core.LiteralString (Literals.showBigint (Literals.uint64ToBigint v0)))] Nothing+ encodeLiteral (Core.LiteralString (Literals.printBigint (Literals.uint64ToBigint v0)))] Nothing encodeLiteral_javaParseDouble :: String -> Syntax.Expression encodeLiteral_javaParseDouble value =@@ -1446,7 +1448,7 @@ encodeNullaryPrimitiveByName env typ name cx g = let aliases = JavaEnvironment.javaEnvironmentAliases env- in (Eithers.bind (encodeNullaryConstant_typeArgsFromReturnType aliases typ cx g) (\targs -> Logic.ifElse (Lists.null targs) (+ in (Eithers.bind (encodeNullaryConstant_typeArgsFromReturnType aliases typ cx g) (\targs -> Logic.ifElse (Lists.isEmpty targs) ( let header = Syntax.MethodInvocation_HeaderSimple (Syntax.MethodName (elementJavaIdentifier True False aliases name)) in (Right (Utils.javaMethodInvocationToJavaExpression (Syntax.MethodInvocation { Syntax.methodInvocationHeader = header,@@ -1470,14 +1472,14 @@ Optionals.match (Packaging.termDefinitionSignature tdef) (Core.TypeScheme { Core.typeSchemeVariables = [], Core.typeSchemeBody = (Core.TypeVariable (Core.Name "hydra.core.Unit")),- Core.typeSchemeConstraints = Nothing}) (\sig -> Scoping.termSignatureToTypeScheme sig)+ Core.typeSchemeConstraints = Maps.empty}) (\sig -> Scoping.termSignatureToTypeScheme sig) term = Variables.unshadowVariables term0 in (Eithers.bind (analyzeJavaFunction env term cx g) (\fs -> let schemeVars = Lists.filter (\v -> isSimpleName v) (Core.typeSchemeVariables ts) termVars = Typing.functionStructureTypeParams fs schemeTypeVars = collectTypeVars (Core.typeSchemeBody ts) usedSchemeVars = Lists.filter (\v -> Sets.member v schemeTypeVars) schemeVars- tparams = Logic.ifElse (Lists.null usedSchemeVars) termVars usedSchemeVars+ tparams = Logic.ifElse (Lists.isEmpty usedSchemeVars) termVars usedSchemeVars params = Typing.functionStructureParams fs bindings = Typing.functionStructureBindings fs body = Typing.functionStructureBody fs@@ -1489,7 +1491,7 @@ schemeDoms = Pairs.first peelResult cod = Pairs.second peelResult schemeVarSet = Sets.fromList tparams- in (Eithers.bind (Logic.ifElse (Lists.null tparams) (Right Maps.empty) (buildSubstFromAnnotations schemeVarSet term cx g)) (\typeVarSubst ->+ in (Eithers.bind (Logic.ifElse (Lists.isEmpty tparams) (Right Maps.empty) (buildSubstFromAnnotations schemeVarSet term cx g)) (\typeVarSubst -> let overgenSubst = detectAccumulatorUnification schemeDoms cod tparams overgenVarSubst = Maps.fromList (Optionals.givens (Lists.map (\entry ->@@ -1498,12 +1500,12 @@ in case v of Core.TypeVariable v0 -> Just (k, v0) _ -> Nothing) (Maps.toList overgenSubst)))- fixedCod = Logic.ifElse (Maps.null overgenSubst) cod (substituteTypeVarsWithTypes overgenSubst cod)+ fixedCod = Logic.ifElse (Maps.isEmpty overgenSubst) cod (substituteTypeVarsWithTypes overgenSubst cod) fixedDoms =- Logic.ifElse (Maps.null overgenSubst) schemeDoms (Lists.map (\d -> substituteTypeVarsWithTypes overgenSubst d) schemeDoms)+ Logic.ifElse (Maps.isEmpty overgenSubst) schemeDoms (Lists.map (\d -> substituteTypeVarsWithTypes overgenSubst d) schemeDoms) fixedTparams =- Logic.ifElse (Maps.null overgenSubst) tparams (Lists.filter (\v -> Logic.not (Maps.member v overgenSubst)) tparams)- constraints = Optionals.withDefault Maps.empty (Core.typeSchemeConstraints ts)+ Logic.ifElse (Maps.isEmpty overgenSubst) tparams (Lists.filter (\v -> Logic.not (Maps.member v overgenSubst)) tparams)+ constraints = Core.typeSchemeConstraints ts jparams = Lists.map (\v -> Utils.javaTypeParameter (Formatting.capitalize (Core.unName v))) fixedTparams aliases2base = JavaEnvironment.javaEnvironmentAliases env2 trustedVars = Sets.unions (Lists.map (\d -> collectTypeVars d) (Lists.concat2 fixedDoms [@@ -1531,14 +1533,14 @@ in (Eithers.bind (bindingsToStatements env2WithTypeParams bindings cx g) (\bindResult -> let bindingStmts = Pairs.first bindResult env3 = Pairs.second bindResult- in (Eithers.bind (Logic.ifElse (Maps.null overgenSubst) (Right body) (applyOvergenSubstToTermAnnotations overgenSubst body cx g)) (\body_ ->+ in (Eithers.bind (Logic.ifElse (Maps.isEmpty overgenSubst) (Right body) (applyOvergenSubstToTermAnnotations overgenSubst body cx g)) (\body_ -> let annotatedBody = propagateTypesInAppChain fixedCod fixedCod body_ in (Eithers.bind (Eithers.mapList (\pair -> Eithers.bind (encodeType aliases2 Sets.empty (Pairs.first pair) cx g) (\jdom -> Right (Utils.javaTypeToJavaFormalParameter jdom (Pairs.second pair)))) (Lists.zip fixedDoms params)) (\jformalParams -> Eithers.bind (encodeType aliases2 Sets.empty fixedCod cx g) (\jcod -> let result = Utils.javaTypeToJavaResult jcod mods = [ Syntax.InterfaceMethodModifierStatic] jname = Utils.sanitizeJavaName (Formatting.decapitalize (Names.localNameOf name))- isTCO = Logic.and (Logic.not (Lists.null params)) (Analysis.isSelfTailRecursive name body)+ isTCO = Logic.and (Logic.not (Lists.isEmpty params)) (Analysis.isSelfTailRecursive name body) in (Eithers.bind (Logic.ifElse isTCO ( let tcoSuffix = "_tco" snapshotNames = Lists.map (\p -> Core.Name (Strings.concat2 (Core.unName p) tcoSuffix)) params@@ -1546,7 +1548,7 @@ snapshotDecls = Lists.map (\pair -> Utils.finalVarDeclarationStatement (Utils.variableToJavaIdentifier (Pairs.second pair)) (Utils.javaIdentifierToJavaExpression (Utils.variableToJavaIdentifier (Pairs.first pair)))) (Lists.zip params snapshotNames) tcoBody =- Logic.ifElse (Lists.null bindings) annotatedBody (Core.TermLet (Core.Let {+ Logic.ifElse (Lists.isEmpty bindings) annotatedBody (Core.TermLet (Core.Let { Core.letBindings = bindings, Core.letBody = annotatedBody})) in (Eithers.bind (encodeTermTCO env2WithTypeParams name params tparams tcoVarRenames 0 tcoBody cx g) (\tcoStmts ->@@ -1575,7 +1577,7 @@ in case term of Core.TermAnnotated v0 -> encodeTermInternal env (Lists.cons (Annotations.getAnnotationMap (Core.annotatedTermAnnotation v0)) anns) tyapps (Core.annotatedTermBody v0) cx g Core.TermApplication v0 -> encodeApplication env v0 cx g- Core.TermEither v0 -> Eithers.bind (Logic.ifElse (Lists.null tyapps) (Right Nothing) (Eithers.bind (takeTypeArgs "either" 2 tyapps cx g) (\ta -> Right (Just ta)))) (\mtargs ->+ Core.TermEither v0 -> Eithers.bind (Logic.ifElse (Lists.isEmpty tyapps) (Right Nothing) (Eithers.bind (takeTypeArgs "either" 2 tyapps cx g) (\ta -> Right (Just ta)))) (\mtargs -> let combinedAnns = Lists.foldl (\acc -> \m -> Maps.union acc m) Maps.empty anns in (Eithers.bind (Eithers.bimap (\_de -> Errors.ErrorOther (Errors.OtherError (Errors.unDecodingError _de))) (\_a -> _a) (Annotations.getType g combinedAnns)) (\mEitherType -> let branchTypes =@@ -1598,7 +1600,7 @@ Core.TermLet v0 -> let bindings = Core.letBindings v0 body = Core.letBody v0- in (Logic.ifElse (Lists.null bindings) (encodeTermInternal env anns [] body cx g) (Eithers.bind (bindingsToStatements env bindings cx g) (\bindResult ->+ in (Logic.ifElse (Lists.isEmpty bindings) (encodeTermInternal env anns [] body cx g) (Eithers.bind (bindingsToStatements env bindings cx g) (\bindResult -> let bindingStmts = Pairs.first bindResult env2 = Pairs.second bindResult in (Eithers.bind (encodeTermInternal env2 anns [] body cx g) (\jbody ->@@ -1619,17 +1621,17 @@ castExpr = Utils.javaCastExpressionToJavaExpression (Utils.javaCastExpression supplierRt (Utils.javaExpressionToJavaUnaryExpression nullaryLambda)) in (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocation (Just (Right (Utils.javaExpressionToJavaPrimary castExpr))) (Syntax.Identifier "get") [])))))))))))))- Core.TermList v0 -> Logic.ifElse (Lists.null v0) (Logic.ifElse (Lists.null tyapps) (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "hydra.overlay.java.util.ConsList") (Syntax.Identifier "empty") []))) (Eithers.bind (takeTypeArgs "list" 1 tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.ConsList") (Syntax.Identifier "empty") targs []))))) (Eithers.bind (Eithers.mapList encode v0) (\jels -> Eithers.bind (collectionTypeArgs "list" 1 aliases anns tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.ConsList") (Syntax.Identifier "of") targs jels)))))+ Core.TermList v0 -> Logic.ifElse (Lists.isEmpty v0) (Logic.ifElse (Lists.isEmpty tyapps) (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "hydra.overlay.java.util.ConsList") (Syntax.Identifier "empty") []))) (Eithers.bind (takeTypeArgs "list" 1 tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.ConsList") (Syntax.Identifier "empty") targs []))))) (Eithers.bind (Eithers.mapList encode v0) (\jels -> Eithers.bind (collectionTypeArgs "list" 1 aliases anns tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.ConsList") (Syntax.Identifier "of") targs jels))))) Core.TermLiteral v0 -> Right (encodeLiteral v0)- Core.TermMap v0 -> Logic.ifElse (Maps.null v0) (Logic.ifElse (Lists.null tyapps) (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "hydra.overlay.java.util.PersistentMap") (Syntax.Identifier "empty") []))) (Eithers.bind (takeTypeArgs "map" 2 tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.PersistentMap") (Syntax.Identifier "empty") targs []))))) (Eithers.bind (Eithers.mapList encode (Maps.keys v0)) (\jkeys -> Eithers.bind (Eithers.mapList encode (Maps.elems v0)) (\jvals ->+ Core.TermMap v0 -> Logic.ifElse (Maps.isEmpty v0) (Logic.ifElse (Lists.isEmpty tyapps) (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "hydra.overlay.java.util.PersistentMap") (Syntax.Identifier "empty") []))) (Eithers.bind (takeTypeArgs "map" 2 tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.PersistentMap") (Syntax.Identifier "empty") targs []))))) (Eithers.bind (Eithers.mapList encode (Maps.keys v0)) (\jkeys -> Eithers.bind (Eithers.mapList encode (Maps.elems v0)) (\jvals -> let pairExprs = Lists.map (\kv -> Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "java.util.Map") (Syntax.Identifier "entry") [ Pairs.first kv, (Pairs.second kv)])) (Lists.zip jkeys jvals) in (Eithers.bind (collectionTypeArgs "map" 2 aliases anns tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.PersistentMap") (Syntax.Identifier "ofEntries") targs pairExprs)))))))- Core.TermOptional v0 -> Optionals.match v0 (Logic.ifElse (Lists.null tyapps) (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "hydra.overlay.java.util.Optional") (Syntax.Identifier "none") []))) (Eithers.bind (takeTypeArgs "optional" 1 tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.Optional") (Syntax.Identifier "none") targs []))))) (\term1 -> Eithers.bind (encode term1) (\expr -> Eithers.bind (collectionTypeArgs "optional" 1 aliases anns tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.Optional") (Syntax.Identifier "given") targs [+ Core.TermOptional v0 -> Optionals.match v0 (Logic.ifElse (Lists.isEmpty tyapps) (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "hydra.overlay.java.util.Optional") (Syntax.Identifier "none") []))) (Eithers.bind (takeTypeArgs "optional" 1 tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.Optional") (Syntax.Identifier "none") targs []))))) (\term1 -> Eithers.bind (encode term1) (\expr -> Eithers.bind (collectionTypeArgs "optional" 1 aliases anns tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.Optional") (Syntax.Identifier "given") targs [ expr])))))- Core.TermPair v0 -> Eithers.bind (encode (Pairs.first v0)) (\jterm1 -> Eithers.bind (encode (Pairs.second v0)) (\jterm2 -> Eithers.bind (Logic.ifElse (Lists.null tyapps) (Right Nothing) (Eithers.bind (Eithers.mapList (\jt -> Utils.javaTypeToJavaReferenceType jt cx) tyapps) (\rts -> Right (Just (Syntax.TypeArgumentsOrDiamondArguments (Lists.map (\rt -> Syntax.TypeArgumentReference rt) rts)))))) (\mtargs -> Right (Utils.javaConstructorCall (Utils.javaConstructorName (Syntax.Identifier "hydra.overlay.java.util.Pair") mtargs) [+ Core.TermPair v0 -> Eithers.bind (encode (Pairs.first v0)) (\jterm1 -> Eithers.bind (encode (Pairs.second v0)) (\jterm2 -> Eithers.bind (Logic.ifElse (Lists.isEmpty tyapps) (Right Nothing) (Eithers.bind (Eithers.mapList (\jt -> Utils.javaTypeToJavaReferenceType jt cx) tyapps) (\rts -> Right (Just (Syntax.TypeArgumentsOrDiamondArguments (Lists.map (\rt -> Syntax.TypeArgumentReference rt) rts)))))) (\mtargs -> Right (Utils.javaConstructorCall (Utils.javaConstructorName (Syntax.Identifier "hydra.overlay.java.util.Pair") mtargs) [ jterm1, jterm2] Nothing)))) Core.TermRecord v0 ->@@ -1646,7 +1648,7 @@ Optionals.bind mAnnotType (\annTyp -> Optionals.bind mRecordType (\recTyp -> let args = extractTypeApplicationArgs (Strip.deannotateType annTyp) params = collectForallParams (Strip.deannotateType recTyp)- in (Logic.ifElse (Logic.or (Lists.null args) (Logic.not (Equality.equal (Lists.length args) (Lists.length params)))) Nothing (Just (Maps.fromList (Lists.zip params args))))))+ in (Logic.ifElse (Logic.or (Lists.isEmpty args) (Logic.not (Equality.equal (Lists.length args) (Lists.length params)))) Nothing (Just (Maps.fromList (Lists.zip params args)))))) encodeField = \fld -> Optionals.match mFieldTypeMap (encode (Core.fieldTerm fld)) (\ftmap -> let mftyp = Maps.lookup (Core.fieldName fld) ftmap@@ -1657,12 +1659,12 @@ in (encodeTermInternal env anns [] annotatedFieldTerm cx g)))) in (Eithers.bind (Eithers.mapList encodeField (Core.recordFields v0)) (\fieldExprs -> let consId = Utils.nameToJavaName aliases recName- in (Eithers.bind (Logic.ifElse (Logic.not (Lists.null tyapps)) (Eithers.bind (Eithers.mapList (\jt -> Utils.javaTypeToJavaReferenceType jt cx) tyapps) (\rts -> Right (Just (Syntax.TypeArgumentsOrDiamondArguments (Lists.map (\rt -> Syntax.TypeArgumentReference rt) rts))))) (+ in (Eithers.bind (Logic.ifElse (Logic.not (Lists.isEmpty tyapps)) (Eithers.bind (Eithers.mapList (\jt -> Utils.javaTypeToJavaReferenceType jt cx) tyapps) (\rts -> Right (Just (Syntax.TypeArgumentsOrDiamondArguments (Lists.map (\rt -> Syntax.TypeArgumentReference rt) rts))))) ( let combinedAnns = Lists.foldl (\acc -> \m -> Maps.union acc m) Maps.empty anns in (Eithers.bind (Eithers.bimap (\_de -> Errors.ErrorOther (Errors.OtherError (Errors.unDecodingError _de))) (\_a -> _a) (Annotations.getType g combinedAnns)) (\mtyp -> Optionals.match mtyp (Right Nothing) (\annTyp -> let typeArgs = extractTypeApplicationArgs (Strip.deannotateType annTyp)- in (Logic.ifElse (Lists.null typeArgs) (Right Nothing) (Eithers.bind (Eithers.mapList (\t -> Eithers.bind (encodeType aliases Sets.empty t cx g) (\jt -> Utils.javaTypeToJavaReferenceType jt cx)) typeArgs) (\jTypeArgs -> Right (Just (Syntax.TypeArgumentsOrDiamondArguments (Lists.map (\rt -> Syntax.TypeArgumentReference rt) jTypeArgs))))))))))) (\mtargs -> Right (Utils.javaConstructorCall (Utils.javaConstructorName consId mtargs) fieldExprs Nothing)))))))- Core.TermSet v0 -> Logic.ifElse (Sets.null v0) (Logic.ifElse (Lists.null tyapps) (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "hydra.overlay.java.util.PersistentSet") (Syntax.Identifier "empty") []))) (Eithers.bind (takeTypeArgs "set" 1 tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.PersistentSet") (Syntax.Identifier "empty") targs []))))) (+ in (Logic.ifElse (Lists.isEmpty typeArgs) (Right Nothing) (Eithers.bind (Eithers.mapList (\t -> Eithers.bind (encodeType aliases Sets.empty t cx g) (\jt -> Utils.javaTypeToJavaReferenceType jt cx)) typeArgs) (\jTypeArgs -> Right (Just (Syntax.TypeArgumentsOrDiamondArguments (Lists.map (\rt -> Syntax.TypeArgumentReference rt) jTypeArgs))))))))))) (\mtargs -> Right (Utils.javaConstructorCall (Utils.javaConstructorName consId mtargs) fieldExprs Nothing)))))))+ Core.TermSet v0 -> Logic.ifElse (Sets.isEmpty v0) (Logic.ifElse (Lists.isEmpty tyapps) (Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStatic (Syntax.Identifier "hydra.overlay.java.util.PersistentSet") (Syntax.Identifier "empty") []))) (Eithers.bind (takeTypeArgs "set" 1 tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.PersistentSet") (Syntax.Identifier "empty") targs []))))) ( let slist = Sets.toList v0 in (Eithers.bind (Eithers.mapList encode slist) (\jels -> Eithers.bind (collectionTypeArgs "set" 1 aliases anns tyapps cx g) (\targs -> Right (Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs (Syntax.Identifier "hydra.overlay.java.util.PersistentSet") (Syntax.Identifier "of") targs jels)))))) Core.TermTypeLambda v0 -> withTypeLambda env v0 (\env2 ->@@ -1792,11 +1794,11 @@ dflt = Core.caseStatementDefault v0 cases_ = Core.caseStatementCases v0 tnameIsGeneric =- Optionals.match (Maps.lookup tname (Graph.graphSchemaTypes g)) False (\ts -> Logic.not (Lists.null (Core.typeSchemeVariables ts)))+ Optionals.match (Maps.lookup tname (Graph.graphSchemaTypes g)) False (\ts -> Logic.not (Lists.isEmpty (Core.typeSchemeVariables ts))) domArgs = Logic.ifElse tnameIsGeneric (Lists.map (\tp -> Utils.typeParameterToTypeArgument (Utils.javaTypeParameter (Formatting.capitalize (Core.unName tp)))) tparams) [] in (Eithers.bind (encodeTerm env arg cx g) (\jArgRaw ->- let depthSuffix = Logic.ifElse (Equality.equal tcoDepth 0) "" (Literals.showInt32 tcoDepth)+ let depthSuffix = Logic.ifElse (Equality.equal tcoDepth 0) "" (Literals.printInt32 tcoDepth) matchVarId = Utils.javaIdentifier (Strings.concat [ "_tco_match_",@@ -1876,7 +1878,7 @@ jfirst, jsecond] JavaNames.hydraUtilPackageName "Pair"))) Core.TypeUnit -> Right (Utils.javaRefType [] JavaNames.javaLangPackageName "Void")- Core.TypeRecord v0 -> Logic.ifElse (Lists.null v0) (Right (Utils.javaRefType [] JavaNames.javaLangPackageName "Void")) (Left (Errors.ErrorOther (Errors.OtherError "unexpected anonymous record type")))+ Core.TypeRecord v0 -> Logic.ifElse (Lists.isEmpty v0) (Right (Utils.javaRefType [] JavaNames.javaLangPackageName "Void")) (Left (Errors.ErrorOther (Errors.OtherError "unexpected anonymous record type"))) Core.TypeOptional v0 -> Eithers.bind (Eithers.bind (encodeType aliases boundVars v0 cx g) (\jt_ -> Utils.javaTypeToJavaReferenceType jt_ cx)) (\jot -> Right (Utils.javaRefType [ jot] JavaNames.hydraUtilPackageName "Optional")) Core.TypeSet v0 -> Eithers.bind (Eithers.bind (encodeType aliases boundVars v0 cx g) (\jt_ -> Utils.javaTypeToJavaReferenceType jt_ cx)) (\jst -> Right (Utils.javaRefType [@@ -1914,7 +1916,7 @@ encodeType_resolveIfTypedef aliases boundVars inScopeTypeParams name cx g = Logic.ifElse (Logic.or (Sets.member name boundVars) (Sets.member name inScopeTypeParams)) (Right Nothing) (Logic.ifElse (isLambdaBoundVariable name) (Right Nothing) ( let schemaTypes = Graph.graphSchemaTypes g- in (Optionals.match (Maps.lookup name schemaTypes) (Right Nothing) (\ts -> Logic.ifElse (Logic.not (Lists.null (Core.typeSchemeVariables ts))) (Right Nothing) (case (Strip.deannotateType (Core.typeSchemeBody ts)) of+ in (Optionals.match (Maps.lookup name schemaTypes) (Right Nothing) (\ts -> Logic.ifElse (Logic.not (Lists.isEmpty (Core.typeSchemeVariables ts))) (Right Nothing) (case (Strip.deannotateType (Core.typeSchemeBody ts)) of Core.TypeRecord _ -> Right Nothing Core.TypeUnion _ -> Right Nothing Core.TypeWrap _ -> Right Nothing@@ -1956,7 +1958,7 @@ encodeVariable_hoistedLambdaCase :: JavaEnvironment.Aliases -> Core.Name -> Int -> t0 -> Graph.Graph -> Either Errors.Error Syntax.Expression encodeVariable_hoistedLambdaCase aliases name arity cx g = - let paramNames = Lists.map (\i -> Core.Name (Strings.concat2 "p" (Literals.showInt32 i))) (Math.range 0 arity)+ let paramNames = Lists.map (\i -> Core.Name (Strings.concat2 "p" (Literals.printInt32 i))) (Math.range 0 arity) paramExprs = Lists.map (\pn -> Utils.javaIdentifierToJavaExpression (Utils.variableToJavaIdentifier pn)) paramNames call = Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocation Nothing (elementJavaIdentifier False False aliases name) paramExprs)@@ -2086,7 +2088,7 @@ filterPhantomTypeArgs_filterAndApply allTypeArgs keepFlags overgenSubst = let filtered = Lists.map (\p -> Pairs.first p) (Lists.filter (\p -> Pairs.second p) (Lists.zip allTypeArgs keepFlags))- in (Logic.ifElse (Logic.not (Maps.null overgenSubst)) (Lists.map (\t -> substituteTypeVarsWithTypes overgenSubst t) filtered) filtered)+ in (Logic.ifElse (Logic.not (Maps.isEmpty overgenSubst)) (Lists.map (\t -> substituteTypeVarsWithTypes overgenSubst t) filtered) filtered) findMatchingLambdaVar :: Core.Name -> S.Set Core.Name -> Core.Name findMatchingLambdaVar name lambdaVars =@@ -2153,7 +2155,7 @@ freshJavaName_go :: Core.Name -> S.Set Core.Name -> Int -> Core.Name freshJavaName_go base avoid i = - let candidate = Core.Name (Strings.concat2 (Core.unName base) (Literals.showInt32 i))+ let candidate = Core.Name (Strings.concat2 (Core.unName base) (Literals.printInt32 i)) in (Logic.ifElse (Sets.member candidate avoid) (freshJavaName_go base avoid (Math.add i 1)) candidate) functionCall :: JavaEnvironment.JavaEnvironment -> Bool -> Core.Name -> [Core.Term] -> [Core.Type] -> Typing.InferenceContext -> Graph.Graph -> Either Errors.Error Syntax.Expression@@ -2170,7 +2172,7 @@ \jid -> Optionals.match mMethodOverride jid (\m -> let s = Syntax.unIdentifier jid in (Syntax.Identifier (Strings.concat2 (Strings.fromList (Lists.take (Math.sub (Strings.length s) (Strings.length JavaNames.applyMethodName)) (Strings.toList s))) m)))- in (Logic.ifElse (Lists.null typeApps) (+ in (Logic.ifElse (Lists.isEmpty typeApps) ( let header = Syntax.MethodInvocation_HeaderSimple (Syntax.MethodName (overrideMethodName (elementJavaIdentifier isPrim False aliases name))) in (Right (Utils.javaMethodInvocationToJavaExpression (Syntax.MethodInvocation {@@ -2396,7 +2398,7 @@ in (Optionals.withDefault False (Optionals.map (\p -> let firstCh = Pairs.first p rest = Pairs.second p- in (Logic.ifElse (Logic.not (Equality.equal firstCh 116)) False (Logic.and (Logic.not (Lists.null rest)) (Lists.null (Lists.filter (\c -> Logic.not (isUnresolvedInferenceVar_isDigit c)) rest))))) (Lists.uncons chars)))+ in (Logic.ifElse (Logic.not (Equality.equal firstCh 116)) False (Logic.and (Logic.not (Lists.isEmpty rest)) (Lists.isEmpty (Lists.filter (\c -> Logic.not (isUnresolvedInferenceVar_isDigit c)) rest))))) (Lists.uncons chars))) isUnresolvedInferenceVar_isDigit :: Int -> Bool isUnresolvedInferenceVar_isDigit c = Logic.and (Ordering.gte c 48) (Ordering.lte c 57)@@ -2473,7 +2475,7 @@ let parts = Strings.splitOn "." (Packaging.unModuleName ns) initParts = Optionals.withDefault [] (Lists.init parts)- in (Logic.ifElse (Lists.null initParts) Nothing (Just (Packaging.ModuleName (Strings.join "." initParts))))+ in (Logic.ifElse (Lists.isEmpty initParts) Nothing (Just (Packaging.ModuleName (Strings.join "." initParts)))) noComment :: Syntax.ClassBodyDeclaration -> Syntax.ClassBodyDeclarationWithComments noComment decl =@@ -2630,7 +2632,7 @@ rebuildApps :: Core.Term -> [Core.Term] -> Core.Type -> Core.Term rebuildApps f args fType =- Logic.ifElse (Lists.null args) f (case (Strip.deannotateType fType) of+ Logic.ifElse (Lists.isEmpty args) f (case (Strip.deannotateType fType) of Core.TypeFunction v0 -> Optionals.withDefault f (Optionals.map (\p -> let arg = Pairs.first p rest = Pairs.second p@@ -2650,7 +2652,7 @@ let typeArgRefs = Lists.map Utils.typeParameterToReferenceType tparams typeArgs = Lists.map (\rt -> Syntax.TypeArgumentReference rt) typeArgRefs- mTypeArgs = Logic.ifElse (Lists.null tparams) Nothing (Just (Syntax.TypeArgumentsOrDiamondArguments typeArgs))+ mTypeArgs = Logic.ifElse (Lists.isEmpty tparams) Nothing (Just (Syntax.TypeArgumentsOrDiamondArguments typeArgs)) recordLocalName = Utils.sanitizeJavaName (Names.localNameOf elName) builderType = Utils.javaRefType typeArgRefs Nothing "Builder" builderResult = Utils.javaTypeToJavaResult builderType@@ -2741,7 +2743,7 @@ castStmt = Utils.variableDeclarationStatement aliases (Utils.javaTypeFromTypeName aliases elName) (Utils.javaIdentifier tmpName) (Utils.javaCastExpressionToJavaExpression (Utils.javaCastExpression (Utils.nameToJavaReferenceType aliases False [] elName Nothing) (Utils.javaIdentifierToJavaUnaryExpression (Syntax.Identifier (Utils.sanitizeJavaName JavaNames.otherInstanceName))))) returnAllFieldsEqual =- Syntax.BlockStatementStatement (Utils.javaReturnStatement (Just (Logic.ifElse (Lists.null fields) (Utils.javaBooleanExpression True) (Utils.javaConditionalAndExpressionToJavaExpression (Syntax.ConditionalAndExpression (Lists.map (\f -> eqClause tmpName f) fields))))))+ Syntax.BlockStatementStatement (Utils.javaReturnStatement (Just (Logic.ifElse (Lists.isEmpty fields) (Utils.javaBooleanExpression True) (Utils.javaConditionalAndExpressionToJavaExpression (Syntax.ConditionalAndExpression (Lists.map (\f -> eqClause tmpName f) fields)))))) in (Utils.methodDeclaration mods [] anns JavaNames.equalsMethodName [ param] result (Just [ instanceOfStmt,@@ -2757,7 +2759,7 @@ Syntax.MethodModifierPublic] result = Utils.javaTypeToJavaResult Utils.javaIntType returnSum =- Syntax.BlockStatementStatement (Logic.ifElse (Lists.null fields) (Utils.javaReturnStatement (Just (Utils.javaIntExpression 0))) (Utils.javaReturnStatement (Just (Utils.javaAdditiveExpressionToJavaExpression (Utils.addExpressions (Lists.zipWith hashCodeMultPair first20Primes (Lists.map (\f -> Core.fieldTypeName f) fields)))))))+ Syntax.BlockStatementStatement (Logic.ifElse (Lists.isEmpty fields) (Utils.javaReturnStatement (Just (Utils.javaIntExpression 0))) (Utils.javaReturnStatement (Just (Utils.javaAdditiveExpressionToJavaExpression (Utils.addExpressions (Lists.zipWith hashCodeMultPair first20Primes (Lists.map (\f -> Core.fieldTypeName f) fields))))))) in (Utils.methodDeclaration mods [] anns JavaNames.hashCodeMethodName [] result (Just [ returnSum])) @@ -3094,7 +3096,7 @@ let classId = Utils.nameToJavaName aliases (elementsQualifiedName ns_) methodId = Syntax.Identifier (Utils.sanitizeJavaName localName) in (Eithers.bind (filterPhantomTypeArgs varName allTypeArgs cx g) (\filteredTypeArgs -> Eithers.bind (Eithers.mapList (\t -> Eithers.bind (encodeType aliases Sets.empty t cx g) (\jt -> Eithers.bind (Utils.javaTypeToJavaReferenceType jt cx) (\rt -> Right (Syntax.TypeArgumentReference rt)))) filteredTypeArgs) (\jTypeArgs ->- let paramNames = Lists.map (\i -> Core.Name (Strings.concat2 "p" (Literals.showInt32 i))) (Math.range 0 v0)+ let paramNames = Lists.map (\i -> Core.Name (Strings.concat2 "p" (Literals.printInt32 i))) (Math.range 0 v0) paramExprs = Lists.map (\p -> Utils.javaIdentifierToJavaExpression (Utils.variableToJavaIdentifier p)) paramNames call = Utils.javaMethodInvocationToJavaExpression (Utils.methodInvocationStaticWithTypeArgs classId methodId jTypeArgs paramExprs)@@ -3150,7 +3152,7 @@ emptyReturn = [ Syntax.BlockStatementStatement (Utils.javaReturnStatement (Just (Utils.javaIntExpression 0)))] valueCompareStmt =- Logic.ifElse (Lists.null fields) emptyReturn (Lists.concat2 [+ Logic.ifElse (Lists.isEmpty fields) emptyReturn (Lists.concat2 [ castDeclStmt] (compareToBody aliases varTmpName fields)) body = Lists.concat2 [
src/main/haskell/Hydra/Java/Environment.hs view
@@ -11,6 +11,7 @@ import qualified Hydra.Typing as Typing import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void import qualified Data.Map as M import qualified Data.Set as S
src/main/haskell/Hydra/Java/Language.hs view
@@ -33,6 +33,7 @@ import qualified Hydra.Variants as Variants import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void import qualified Data.Set as S -- | Language constraints for Java
src/main/haskell/Hydra/Java/Names.hs view
@@ -31,6 +31,7 @@ import qualified Hydra.Variants as Variants import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void acceptMethodName :: String acceptMethodName = "accept"
src/main/haskell/Hydra/Java/Serde.hs view
@@ -43,6 +43,7 @@ import qualified Hydra.Variants as Variants import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void additionalBoundToExpr :: Syntax.AdditionalBound -> Ast.Expr additionalBoundToExpr ab =@@ -200,7 +201,7 @@ in (Serialization.parenList False [ Serialization.spaceSep (Optionals.givens [ Just (referenceTypeToExpr rt),- (Logic.ifElse (Lists.null adds) Nothing (Just (Serialization.spaceSep (Lists.map additionalBoundToExpr adds))))])])+ (Logic.ifElse (Lists.isEmpty adds) Nothing (Just (Serialization.spaceSep (Lists.map additionalBoundToExpr adds))))])]) castExpressionToExpr :: Syntax.CastExpression -> Ast.Expr castExpressionToExpr e =@@ -306,9 +307,9 @@ (typeIdentifierToExpr id)] in (Serialization.noSep (Optionals.givens [ Just (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null anns) Nothing (Just (Serialization.commaSep Serialization.inlineStyle (Lists.map annotationToExpr anns))),+ Logic.ifElse (Lists.isEmpty anns) Nothing (Just (Serialization.commaSep Serialization.inlineStyle (Lists.map annotationToExpr anns))), (Just qualifiedId)])),- (Logic.ifElse (Lists.null args) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeArgumentToExpr args))))]))+ (Logic.ifElse (Lists.isEmpty args) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeArgumentToExpr args))))])) compilationUnitToExpr :: Syntax.CompilationUnit -> Ast.Expr compilationUnitToExpr u =@@ -320,9 +321,9 @@ warning = Just (singleLineComment Constants.warningAutoGeneratedFile) pkgSec = Optionals.map packageDeclarationToExpr mpkg importsSec =- Logic.ifElse (Lists.null imports) Nothing (Just (Serialization.newlineSep (Lists.map importDeclarationToExpr imports)))+ Logic.ifElse (Lists.isEmpty imports) Nothing (Just (Serialization.newlineSep (Lists.map importDeclarationToExpr imports))) typesSec =- Logic.ifElse (Lists.null types) Nothing (Just (Serialization.doubleNewlineSep (Lists.map typeDeclarationWithCommentsToExpr types)))+ Logic.ifElse (Lists.isEmpty types) Nothing (Just (Serialization.doubleNewlineSep (Lists.map typeDeclarationWithCommentsToExpr types))) in (Serialization.doubleNewlineSep (Optionals.givens [ warning, pkgSec,@@ -357,7 +358,7 @@ typ = Syntax.constantDeclarationType cd vars = Syntax.constantDeclarationVariables cd in (Serialization.withSemi (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map constantModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map constantModifierToExpr mods))), (Just (unannTypeToExpr typ)), (Just (Serialization.commaSep Serialization.inlineStyle (Lists.map variableDeclaratorToExpr vars)))]))) @@ -381,7 +382,7 @@ mthrows = Syntax.constructorDeclarationThrows cd body = Syntax.constructorDeclarationBody cd in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map constructorModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map constructorModifierToExpr mods))), (Just (constructorDeclaratorToExpr cons)), (Optionals.map throwsToExpr mthrows), (Just (constructorBodyToExpr body))]))@@ -393,7 +394,7 @@ name = Syntax.constructorDeclaratorName cd fparams = Syntax.constructorDeclaratorFormalParameters cd in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null tparams) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeParameterToExpr tparams))),+ Logic.ifElse (Lists.isEmpty tparams) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeParameterToExpr tparams))), (Just (simpleTypeNameToExpr name)), (Just (Serialization.parenListAdaptive (Lists.map formalParameterToExpr fparams)))])) @@ -492,7 +493,7 @@ typ = Syntax.fieldDeclarationUnannType fd vars = Syntax.fieldDeclarationVariableDeclarators fd in (Serialization.withSemi (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map fieldModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map fieldModifierToExpr mods))), (Just (unannTypeToExpr typ)), (Just (Serialization.commaSep Serialization.inlineStyle (Lists.map variableDeclaratorToExpr vars)))]))) @@ -510,7 +511,7 @@ floatingPointLiteralToExpr :: Syntax.FloatingPointLiteral -> Ast.Expr floatingPointLiteralToExpr fl =- Serialization.cst (javaFloatLiteralText (Literals.showFloat64 (Syntax.unFloatingPointLiteral fl)))+ Serialization.cst (javaFloatLiteralText (Literals.printFloat64 (Syntax.unFloatingPointLiteral fl))) floatingPointTypeToExpr :: Syntax.FloatingPointType -> Ast.Expr floatingPointTypeToExpr ft =@@ -528,7 +529,7 @@ typ = Syntax.formalParameter_SimpleType fps id = Syntax.formalParameter_SimpleId fps in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map variableModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map variableModifierToExpr mods))), (Just (unannTypeToExpr typ)), (Just (variableDeclaratorIdToExpr id))])) @@ -577,7 +578,7 @@ let i = Syntax.unIntegerLiteral il suffix = Logic.ifElse (Logic.or (Ordering.gt i 2147483647) (Ordering.lt i (-2147483648))) "L" ""- in (Serialization.cst (Strings.concat2 (Literals.showBigint i) suffix))+ in (Serialization.cst (Strings.concat2 (Literals.printBigint i) suffix)) integralTypeToExpr :: Syntax.IntegralType -> Ast.Expr integralTypeToExpr t =@@ -620,7 +621,7 @@ header = Syntax.interfaceMethodDeclarationHeader imd body = Syntax.interfaceMethodDeclarationBody imd in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map interfaceMethodModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map interfaceMethodModifierToExpr mods))), (Just (methodHeaderToExpr header)), (Just (methodBodyToExpr body))])) @@ -725,7 +726,7 @@ t = Syntax.localVariableDeclarationType lvd decls = Syntax.localVariableDeclarationDeclarators lvd in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map variableModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map variableModifierToExpr mods))), (Just (localNameToExpr t)), (Just (Serialization.commaSep Serialization.inlineStyle (Lists.map variableDeclaratorToExpr decls)))])) @@ -747,11 +748,11 @@ body = Syntax.methodDeclarationBody md headerAndBody = Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map methodModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map methodModifierToExpr mods))), (Just (methodHeaderToExpr header)), (Just (methodBodyToExpr body))]) in (Serialization.newlineSep (Optionals.givens [- Logic.ifElse (Lists.null anns) Nothing (Just (Serialization.newlineSep (Lists.map annotationToExpr anns))),+ Logic.ifElse (Lists.isEmpty anns) Nothing (Just (Serialization.newlineSep (Lists.map annotationToExpr anns))), (Just headerAndBody)])) methodDeclaratorToExpr :: Syntax.MethodDeclarator -> Ast.Expr@@ -771,7 +772,7 @@ decl = Syntax.methodHeaderDeclarator mh mthrows = Syntax.methodHeaderThrows mh in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null params) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeParameterToExpr params))),+ Logic.ifElse (Lists.isEmpty params) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeParameterToExpr params))), (Just (resultToExpr result)), (Just (methodDeclaratorToExpr decl)), (Optionals.map throwsToExpr mthrows)]))@@ -791,7 +792,7 @@ cid = Syntax.methodInvocation_ComplexIdentifier v0 idSec = Serialization.noSep (Optionals.givens [- Logic.ifElse (Lists.null targs) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeArgumentToExpr targs))),+ Logic.ifElse (Lists.isEmpty targs) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeArgumentToExpr targs))), (Just (identifierToExpr cid))]) in case cvar of Syntax.MethodInvocation_VariantType v1 -> Serialization.dotSep [@@ -861,15 +862,15 @@ superi = Syntax.normalClassDeclarationImplements ncd body = Syntax.normalClassDeclarationBody ncd in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map classModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map classModifierToExpr mods))), (Just (Serialization.cst "class")), (Just (Serialization.noSep (Optionals.givens [ Just (typeIdentifierToExpr id),- (Logic.ifElse (Lists.null tparams) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeParameterToExpr tparams))))]))),+ (Logic.ifElse (Lists.isEmpty tparams) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeParameterToExpr tparams))))]))), (Optionals.map (\c -> Serialization.spaceSep [ Serialization.cst "extends", (classTypeToExpr c)]) msuperc),- (Logic.ifElse (Lists.null superi) Nothing (Just (Serialization.spaceSep [+ (Logic.ifElse (Lists.isEmpty superi) Nothing (Just (Serialization.spaceSep [ Serialization.cst "implements", (Serialization.commaSep Serialization.inlineStyle (Lists.map interfaceTypeToExpr superi))]))), (Just (classBodyToExpr body))]))@@ -883,12 +884,12 @@ extends = Syntax.normalInterfaceDeclarationExtends nid body = Syntax.normalInterfaceDeclarationBody nid in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map interfaceModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map interfaceModifierToExpr mods))), (Just (Serialization.cst "interface")), (Just (Serialization.noSep (Optionals.givens [ Just (typeIdentifierToExpr id),- (Logic.ifElse (Lists.null tparams) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeParameterToExpr tparams))))]))),- (Logic.ifElse (Lists.null extends) Nothing (Just (Serialization.spaceSep [+ (Logic.ifElse (Lists.isEmpty tparams) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeParameterToExpr tparams))))]))),+ (Logic.ifElse (Lists.isEmpty extends) Nothing (Just (Serialization.spaceSep [ Serialization.cst "extends", (Serialization.commaSep Serialization.inlineStyle (Lists.map interfaceTypeToExpr extends))]))), (Just (interfaceBodyToExpr body))]))@@ -905,7 +906,7 @@ let mods = Syntax.packageDeclarationModifiers pd ids = Syntax.packageDeclarationIdentifiers pd in (Serialization.withSemi (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map packageModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map packageModifierToExpr mods))), (Just (Serialization.spaceSep [ Serialization.cst "package", (Serialization.cst (Strings.join "." (Lists.map (\id -> Syntax.unIdentifier id) ids)))]))])))@@ -974,7 +975,7 @@ let pt = Syntax.primitiveTypeWithAnnotationsType ptwa anns = Syntax.primitiveTypeWithAnnotationsAnnotations ptwa in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null anns) Nothing (Just (Serialization.spaceSep (Lists.map annotationToExpr anns))),+ Logic.ifElse (Lists.isEmpty anns) Nothing (Just (Serialization.spaceSep (Lists.map annotationToExpr anns))), (Just (primitiveTypeToExpr pt))])) receiverParameterToExpr :: t0 -> Ast.Expr@@ -1153,7 +1154,7 @@ Syntax.TypeBoundClassOrInterface v0 -> let cit = Syntax.typeBound_ClassOrInterfaceType v0 additional = Syntax.typeBound_ClassOrInterfaceAdditional v0- in (Logic.ifElse (Lists.null additional) (classOrInterfaceTypeToExpr cit) (Serialization.spaceSep (Lists.cons (classOrInterfaceTypeToExpr cit) (Lists.map additionalBoundToExpr additional))))+ in (Logic.ifElse (Lists.isEmpty additional) (classOrInterfaceTypeToExpr cit) (Serialization.spaceSep (Lists.cons (classOrInterfaceTypeToExpr cit) (Lists.map additionalBoundToExpr additional)))) typeDeclarationToExpr :: Syntax.TopLevelClassOrInterfaceDeclaration -> Ast.Expr typeDeclarationToExpr d =@@ -1191,7 +1192,7 @@ id = Syntax.typeParameterIdentifier tp bound = Syntax.typeParameterBound tp in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null mods) Nothing (Just (Serialization.spaceSep (Lists.map typeParameterModifierToExpr mods))),+ Logic.ifElse (Lists.isEmpty mods) Nothing (Just (Serialization.spaceSep (Lists.map typeParameterModifierToExpr mods))), (Just (typeIdentifierToExpr id)), (Optionals.map (\b -> Serialization.spaceSep [ Serialization.cst "extends",@@ -1209,7 +1210,7 @@ let anns = Syntax.typeVariableAnnotations tv id = Syntax.typeVariableIdentifier tv in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null anns) Nothing (Just (Serialization.spaceSep (Lists.map annotationToExpr anns))),+ Logic.ifElse (Lists.isEmpty anns) Nothing (Just (Serialization.spaceSep (Lists.map annotationToExpr anns))), (Just (typeIdentifierToExpr id))])) unannTypeToExpr :: Syntax.UnannType -> Ast.Expr@@ -1249,7 +1250,7 @@ mbody = Syntax.unqualifiedClassInstanceCreationExpressionBody ucice in (Serialization.spaceSep (Optionals.givens [ Just (Serialization.cst "new"),- (Logic.ifElse (Lists.null targs) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeArgumentToExpr targs)))),+ (Logic.ifElse (Lists.isEmpty targs) Nothing (Just (Serialization.angleBracesList Serialization.inlineStyle (Lists.map typeArgumentToExpr targs)))), (Just (Serialization.noSep [ classOrInterfaceTypeToInstantiateToExpr cit, (Serialization.parenList False (Lists.map expressionToExpr args))])),@@ -1315,7 +1316,7 @@ let anns = Syntax.wildcardAnnotations w mbounds = Syntax.wildcardWildcard w in (Serialization.spaceSep (Optionals.givens [- Logic.ifElse (Lists.null anns) Nothing (Just (Serialization.commaSep Serialization.inlineStyle (Lists.map annotationToExpr anns))),+ Logic.ifElse (Lists.isEmpty anns) Nothing (Just (Serialization.commaSep Serialization.inlineStyle (Lists.map annotationToExpr anns))), (Just (Serialization.cst "*")), (Optionals.map wildcardBoundsToExpr mbounds)]))
src/main/haskell/Hydra/Java/Syntax.hs view
@@ -9,6 +9,7 @@ import qualified Hydra.Core as Core import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void newtype Identifier = Identifier {
src/main/haskell/Hydra/Java/Testing.hs view
@@ -41,6 +41,7 @@ import qualified Hydra.Variants as Variants import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void -- | Build the complete Java test module content buildJavaTestModule :: Packaging.Module -> Testing.TestGroup -> String -> String@@ -106,7 +107,7 @@ Testing.TestCaseUniversal v0 -> let actual_ = Testing.universalTestCaseActual v0 () expected_ = Testing.universalTestCaseExpected v0 ()- fullName = Logic.ifElse (Lists.null groupPath) name_ (Strings.join "_" (Lists.concat2 groupPath [+ fullName = Logic.ifElse (Lists.isEmpty groupPath) name_ (Strings.join "_" (Lists.concat2 groupPath [ name_])) formattedName = formatJavaTestName fullName in (Right [
src/main/haskell/Hydra/Java/Utils.hs view
@@ -48,6 +48,7 @@ import qualified Hydra.Variants as Variants import Prelude hiding (Enum, Ordering, decodeFloat, encodeFloat, fail, lines, map, pure, sum, unlines) import qualified Data.Scientific as Sci+import Data.Void import qualified Data.Map as M import qualified Data.Set as S @@ -812,7 +813,7 @@ methodInvocationStaticWithTypeArgs :: Syntax.Identifier -> Syntax.Identifier -> [Syntax.TypeArgument] -> [Syntax.Expression] -> Syntax.MethodInvocation methodInvocationStaticWithTypeArgs self methodName targs args =- Logic.ifElse (Lists.null targs) (methodInvocationStatic self methodName args) (+ Logic.ifElse (Lists.isEmpty targs) (methodInvocationStatic self methodName args) ( let header = Syntax.MethodInvocation_HeaderComplex (Syntax.MethodInvocation_Complex { Syntax.methodInvocation_ComplexVariant = (Syntax.MethodInvocation_VariantExpression (javaIdentifierToJavaExpressionName self)),@@ -1001,7 +1002,7 @@ uniqueVarName_go :: Environment.Aliases -> String -> Int -> Core.Name uniqueVarName_go aliases base n = - let candidate = Core.Name (Strings.concat2 base (Literals.showInt32 n))+ let candidate = Core.Name (Strings.concat2 base (Literals.printInt32 n)) in (Logic.ifElse (Sets.member candidate (Environment.aliasesInScopeJavaVars aliases)) (uniqueVarName_go aliases base (Math.add n 1)) candidate) varDeclarationStatement :: Syntax.Identifier -> Syntax.Expression -> Syntax.BlockStatement