jade-lang 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +91 -1
  3. data/README.md +12 -11
  4. data/lib/jade/codegen/function_call.rb +1 -1
  5. data/lib/jade/codegen/inlines.rb +13 -0
  6. data/lib/jade/codegen/{port_decoder.rb → port_codec.rb} +27 -15
  7. data/lib/jade/codegen.rb +7 -3
  8. data/lib/jade/debug.rb +59 -0
  9. data/lib/jade/diagnostics/renderer.rb +16 -5
  10. data/lib/jade/frontend/forward_declaration/interop_import_declaration.rb +13 -3
  11. data/lib/jade/frontend/pattern_analysis/matrix.rb +57 -23
  12. data/lib/jade/frontend/semantic_analysis/constructor_reference.rb +33 -7
  13. data/lib/jade/frontend/semantic_analysis/error/constructor_not_found.rb +20 -5
  14. data/lib/jade/frontend/type_checking/constraints/deriving/decodable.rb +25 -17
  15. data/lib/jade/frontend/type_checking/constraints/deriving/encodable.rb +25 -34
  16. data/lib/jade/frontend/type_checking/constraints/deriving/eq.rb +51 -175
  17. data/lib/jade/frontend/type_checking/constraints/deriving/helpers.rb +133 -0
  18. data/lib/jade/frontend/type_checking/constraints/deriving/show.rb +186 -0
  19. data/lib/jade/frontend/type_checking/constraints/deriving.rb +2 -1
  20. data/lib/jade/frontend/type_checking/env.rb +3 -0
  21. data/lib/jade/frontend/type_checking/error/port_not_encodable.rb +38 -0
  22. data/lib/jade/frontend/type_checking/port_resolution.rb +64 -16
  23. data/lib/jade/interop/runtime.rb +10 -2
  24. data/lib/jade/module_loader.rb +27 -3
  25. data/lib/jade/parsing/error.rb +19 -0
  26. data/lib/jade/runtime.rb +1 -0
  27. data/lib/jade/stdlib/debug.rb +12 -0
  28. data/lib/jade/stdlib/decode.rb +22 -0
  29. data/lib/jade/stdlib/encode.rb +17 -0
  30. data/lib/jade/stdlib/intrinsics.rb +3 -0
  31. data/lib/jade/stdlib/show.rb +40 -0
  32. data/lib/jade/stdlib.rb +5 -2
  33. data/lib/jade/symbol/interop_function.rb +3 -1
  34. data/lib/jade/symbol.rb +2 -2
  35. data/lib/jade/version.rb +1 -1
  36. metadata +8 -3
data/lib/jade/stdlib.rb CHANGED
@@ -16,6 +16,8 @@ require 'jade/stdlib/bytes'
16
16
  require 'jade/stdlib/calendar'
17
17
  require 'jade/stdlib/clock'
18
18
  require 'jade/stdlib/decimal'
19
+ require 'jade/stdlib/show'
20
+ require 'jade/stdlib/debug'
19
21
 
20
22
  module Jade
21
23
  module Stdlib
@@ -26,6 +28,7 @@ module Jade
26
28
  Decode Encode
27
29
  Bytes
28
30
  Dict Set
31
+ Show Debug
29
32
  ].freeze
30
33
  COMPILED = %w[Maybe Result Decode.Params Calendar Clock Decimal].freeze
31
34
  TOPLEVELS = (INTRINSICS + COMPILED).map { it.split('.', 2).first }.to_set.freeze
@@ -35,13 +38,13 @@ module Jade
35
38
  Stdlib::Dict, Stdlib::Set,
36
39
  Stdlib::Decode, Stdlib::Decode::Params, Stdlib::Encode,
37
40
  Stdlib::Bytes,
38
- Stdlib::Calendar, Stdlib::Clock, Stdlib::Decimal,
41
+ Stdlib::Calendar, Stdlib::Clock, Stdlib::Decimal, Stdlib::Show, Stdlib::Debug,
39
42
  ]
40
43
  # Loaded into the registry but not auto-imported into user modules.
41
44
  EXTENSIONS = [
42
45
  Stdlib::Dict, Stdlib::Set,
43
46
  Stdlib::Decode, Stdlib::Decode::Params, Stdlib::Encode,
44
- Stdlib::Calendar, Stdlib::Clock, Stdlib::Decimal,
47
+ Stdlib::Calendar, Stdlib::Clock, Stdlib::Decimal, Stdlib::Show, Stdlib::Debug,
45
48
  ]
46
49
 
47
50
  def load(registry)
@@ -6,8 +6,10 @@ module Jade
6
6
  :params,
7
7
  :return_type,
8
8
  :interop_module_name,
9
- :constraints, # [[iface_qname, var_name]] — implicit Decodable on var arms
9
+ :constraints, # [[iface_qname, var_name]] — implicit Decodable on the
10
+ # return arms' vars, Encodable on the params'
10
11
  :decoders, # { ok: impl_or_pass_or_dict, err: ... } | nil
12
+ :encoders, # [impl_or_pass_or_dict], one per param | nil
11
13
  ) do
12
14
  include Base
13
15
 
data/lib/jade/symbol.rb CHANGED
@@ -103,11 +103,11 @@ module Jade
103
103
  end
104
104
 
105
105
  def predeclared_interop_function(name)
106
- InteropFunction[nil, name, [], nil, nil, [], nil]
106
+ InteropFunction[nil, name, [], nil, nil, [], nil, nil]
107
107
  end
108
108
 
109
109
  def interop_function(name, params, return_type, interop_module_name, constraints: [])
110
- InteropFunction[nil, name, params, return_type, interop_module_name, constraints, nil]
110
+ InteropFunction[nil, name, params, return_type, interop_module_name, constraints, nil, nil]
111
111
  end
112
112
 
113
113
  def type_application(constructor, args, span)
data/lib/jade/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jade
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jade-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Cornu
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-07-30 00:00:00.000000000 Z
10
+ date: 2026-08-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: base64
@@ -69,13 +69,14 @@ files:
69
69
  - lib/jade/codegen/inlines.rb
70
70
  - lib/jade/codegen/method_names.rb
71
71
  - lib/jade/codegen/pattern/constructor.rb
72
- - lib/jade/codegen/port_decoder.rb
72
+ - lib/jade/codegen/port_codec.rb
73
73
  - lib/jade/codegen/pretty.rb
74
74
  - lib/jade/codegen/transforms/fold_shape.rb
75
75
  - lib/jade/codegen/transforms/self_call.rb
76
76
  - lib/jade/codegen/transforms/tail_call.rb
77
77
  - lib/jade/codegen/variant_declaration.rb
78
78
  - lib/jade/compiler.rb
79
+ - lib/jade/debug.rb
79
80
  - lib/jade/decode.rb
80
81
  - lib/jade/diagnostics.rb
81
82
  - lib/jade/diagnostics/renderer.rb
@@ -211,6 +212,7 @@ files:
211
212
  - lib/jade/frontend/type_checking/constraints/deriving/encodable.rb
212
213
  - lib/jade/frontend/type_checking/constraints/deriving/eq.rb
213
214
  - lib/jade/frontend/type_checking/constraints/deriving/helpers.rb
215
+ - lib/jade/frontend/type_checking/constraints/deriving/show.rb
214
216
  - lib/jade/frontend/type_checking/constraints/deriving/sql_mapper.rb
215
217
  - lib/jade/frontend/type_checking/definition.rb
216
218
  - lib/jade/frontend/type_checking/env.rb
@@ -228,6 +230,7 @@ files:
228
230
  - lib/jade/frontend/type_checking/error/missing_patterns.rb
229
231
  - lib/jade/frontend/type_checking/error/pattern_type_mismatch.rb
230
232
  - lib/jade/frontend/type_checking/error/port_not_decodable.rb
233
+ - lib/jade/frontend/type_checking/error/port_not_encodable.rb
231
234
  - lib/jade/frontend/type_checking/error/record_access_type_mismatch.rb
232
235
  - lib/jade/frontend/type_checking/error/type_mismatch.rb
233
236
  - lib/jade/frontend/type_checking/error/unresolved_constraint.rb
@@ -311,6 +314,7 @@ files:
311
314
  - lib/jade/stdlib/char.rb
312
315
  - lib/jade/stdlib/clock.rb
313
316
  - lib/jade/stdlib/compiled.rb
317
+ - lib/jade/stdlib/debug.rb
314
318
  - lib/jade/stdlib/decimal.rb
315
319
  - lib/jade/stdlib/decode.rb
316
320
  - lib/jade/stdlib/decode/params.rb
@@ -321,6 +325,7 @@ files:
321
325
  - lib/jade/stdlib/maybe.rb
322
326
  - lib/jade/stdlib/result.rb
323
327
  - lib/jade/stdlib/set.rb
328
+ - lib/jade/stdlib/show.rb
324
329
  - lib/jade/stdlib/string.rb
325
330
  - lib/jade/stdlib/task.rb
326
331
  - lib/jade/stdlib/tuple.rb