Module: Jade::Interop::Lowering
- Extended by:
- Lowering
- Included in:
- Lowering
- Defined in:
- lib/jade/interop/lowering.rb,
lib/jade/interop/lowering/error.rb
Defined Under Namespace
Classes: Error, FunctionError, TypeParamError
Instance Method Summary collapse
-
#validate(symbol, registry, entry) ⇒ Object
Walks a port’s return type and returns the kinds of types that can never have a Decodable instance: function types.
Instance Method Details
#validate(symbol, registry, entry) ⇒ Object
Walks a port’s return type and returns the kinds of types that can never have a Decodable instance: function types. Bare type variables are permitted at top-level arms (PortResolution turns them into late-bound Dict markers) and rejected at nested positions (PortResolution’s compound-var check fires).
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/jade/interop/lowering.rb', line 13 def validate(symbol, registry, entry) case symbol in Symbol::Variable [] in Symbol::Function(name:) [FunctionError.new(name)] in Symbol::FunctionType [FunctionError.new('inline function type')] in Symbol::TypeApplication(args:) args.flat_map { validate(it, registry, entry) } in Symbol::RecordType(fields:) fields.values.flat_map { validate(it, registry, entry) } in Symbol::Struct(record_type:) validate(record_type, registry, entry) in Symbol::TypeRef lookup_type(symbol, registry, entry) &.then { validate(it, registry, entry) } || [] else [] end end |