Skip to content

Commit

Permalink
Merge branch 'topic/terms-gen-meta-named-returns'
Browse files Browse the repository at this point in the history
  • Loading branch information
bb010g committed Jan 14, 2025
2 parents 6d00204 + 93137b2 commit 5609a6f
Show file tree
Hide file tree
Showing 15 changed files with 910 additions and 377 deletions.
10 changes: 6 additions & 4 deletions terms-gen-meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ return {}]],
function $typename:is_$variant() end]],

unwrap_method = [[
---@return $(, )parts
---@return $(
---@return )parts
function $typename:unwrap_$variant() end]],

as_method = [[
---@return $(, )parts
---@return $(
---@return )parts
function $typename:as_$variant() end]],

unit_constructor = [[---@field $variant $typename]],
Expand Down Expand Up @@ -139,8 +141,8 @@ local function build_meta_file_for_enum(info)
local param_type = vinfo.params_types[i]
local ptype = traits.value_name:get(param_type).value_name()
params_ascribed[#params_ascribed + 1] = param .. ": " .. ptype
unwraptypes[#unwraptypes + 1] = ptype
astypes[#astypes + 1] = ptype
unwraptypes[#unwraptypes + 1] = ptype .. " " .. param
astypes[#astypes + 1] = ptype .. " " .. param
end
constructors[#constructors + 1] = {
kind = "record_constructor",
Expand Down
34 changes: 26 additions & 8 deletions types/binding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,45 @@ binding = {}

---@return boolean
function binding:is_let() end
---@return string, inferrable
---@return string name
---@return inferrable expr
function binding:unwrap_let() end
---@return boolean, string, inferrable
---@return boolean
---@return string name
---@return inferrable expr
function binding:as_let() end
---@return boolean
function binding:is_tuple_elim() end
---@return ArrayValue, inferrable
---@return ArrayValue names
---@return inferrable subject
function binding:unwrap_tuple_elim() end
---@return boolean, ArrayValue, inferrable
---@return boolean
---@return ArrayValue names
---@return inferrable subject
function binding:as_tuple_elim() end
---@return boolean
function binding:is_annotated_lambda() end
---@return string, inferrable, Anchor, visibility, checkable
---@return string param_name
---@return inferrable param_annotation
---@return Anchor start_anchor
---@return visibility visible
---@return checkable pure
function binding:unwrap_annotated_lambda() end
---@return boolean, string, inferrable, Anchor, visibility, checkable
---@return boolean
---@return string param_name
---@return inferrable param_annotation
---@return Anchor start_anchor
---@return visibility visible
---@return checkable pure
function binding:as_annotated_lambda() end
---@return boolean
function binding:is_program_sequence() end
---@return inferrable, Anchor
---@return inferrable first
---@return Anchor start_anchor
function binding:unwrap_program_sequence() end
---@return boolean, inferrable, Anchor
---@return boolean
---@return inferrable first
---@return Anchor start_anchor
function binding:as_program_sequence() end

---@class (exact) bindingType: EnumType
Expand Down
5 changes: 3 additions & 2 deletions types/block_purity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ function block_purity:unwrap_pure() end
function block_purity:as_pure() end
---@return boolean
function block_purity:is_dependent() end
---@return value
---@return value val
function block_purity:unwrap_dependent() end
---@return boolean, value
---@return boolean
---@return value val
function block_purity:as_dependent() end
---@return boolean
function block_purity:is_inherit() end
Expand Down
22 changes: 14 additions & 8 deletions types/checkable.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,33 @@ checkable = {}

---@return boolean
function checkable:is_inferrable() end
---@return inferrable
---@return inferrable inferrable_term
function checkable:unwrap_inferrable() end
---@return boolean, inferrable
---@return boolean
---@return inferrable inferrable_term
function checkable:as_inferrable() end
---@return boolean
function checkable:is_tuple_cons() end
---@return ArrayValue
---@return ArrayValue elements
function checkable:unwrap_tuple_cons() end
---@return boolean, ArrayValue
---@return boolean
---@return ArrayValue elements
function checkable:as_tuple_cons() end
---@return boolean
function checkable:is_host_tuple_cons() end
---@return ArrayValue
---@return ArrayValue elements
function checkable:unwrap_host_tuple_cons() end
---@return boolean, ArrayValue
---@return boolean
---@return ArrayValue elements
function checkable:as_host_tuple_cons() end
---@return boolean
function checkable:is_lambda() end
---@return string, checkable
---@return string param_name
---@return checkable body
function checkable:unwrap_lambda() end
---@return boolean, string, checkable
---@return boolean
---@return string param_name
---@return checkable body
function checkable:as_lambda() end

---@class (exact) checkableType: EnumType
Expand Down
50 changes: 38 additions & 12 deletions types/constraintcause.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,65 @@ constraintcause = {}

---@return boolean
function constraintcause:is_primitive() end
---@return string, Anchor
---@return string description
---@return Anchor position
function constraintcause:unwrap_primitive() end
---@return boolean, string, Anchor
---@return boolean
---@return string description
---@return Anchor position
function constraintcause:as_primitive() end
---@return boolean
function constraintcause:is_composition() end
---@return number, number, Anchor
---@return number left
---@return number right
---@return Anchor position
function constraintcause:unwrap_composition() end
---@return boolean, number, number, Anchor
---@return boolean
---@return number left
---@return number right
---@return Anchor position
function constraintcause:as_composition() end
---@return boolean
function constraintcause:is_nested() end
---@return string, constraintcause
---@return string description
---@return constraintcause inner
function constraintcause:unwrap_nested() end
---@return boolean, string, constraintcause
---@return boolean
---@return string description
---@return constraintcause inner
function constraintcause:as_nested() end
---@return boolean
function constraintcause:is_leftcall_discharge() end
---@return number, number, Anchor
---@return number call
---@return number constraint
---@return Anchor position
function constraintcause:unwrap_leftcall_discharge() end
---@return boolean, number, number, Anchor
---@return boolean
---@return number call
---@return number constraint
---@return Anchor position
function constraintcause:as_leftcall_discharge() end
---@return boolean
function constraintcause:is_rightcall_discharge() end
---@return number, number, Anchor
---@return number constraint
---@return number call
---@return Anchor position
function constraintcause:unwrap_rightcall_discharge() end
---@return boolean, number, number, Anchor
---@return boolean
---@return number constraint
---@return number call
---@return Anchor position
function constraintcause:as_rightcall_discharge() end
---@return boolean
function constraintcause:is_lost() end
---@return string, string, any
---@return string unique_string
---@return string stacktrace
---@return any auxiliary
function constraintcause:unwrap_lost() end
---@return boolean, string, string, any
---@return boolean
---@return string unique_string
---@return string stacktrace
---@return any auxiliary
function constraintcause:as_lost() end

---@class (exact) constraintcauseType: EnumType
Expand Down
74 changes: 62 additions & 12 deletions types/constraintelem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,89 @@ constraintelem = {}

---@return boolean
function constraintelem:is_sliced_constrain() end
---@return SubtypeRelation, typed, TypecheckingContext, constraintcause
---@return SubtypeRelation rel
---@return typed right
---@return TypecheckingContext rightctx
---@return constraintcause cause
function constraintelem:unwrap_sliced_constrain() end
---@return boolean, SubtypeRelation, typed, TypecheckingContext, constraintcause
---@return boolean
---@return SubtypeRelation rel
---@return typed right
---@return TypecheckingContext rightctx
---@return constraintcause cause
function constraintelem:as_sliced_constrain() end
---@return boolean
function constraintelem:is_constrain_sliced() end
---@return typed, TypecheckingContext, SubtypeRelation, constraintcause
---@return typed left
---@return TypecheckingContext leftctx
---@return SubtypeRelation rel
---@return constraintcause cause
function constraintelem:unwrap_constrain_sliced() end
---@return boolean, typed, TypecheckingContext, SubtypeRelation, constraintcause
---@return boolean
---@return typed left
---@return TypecheckingContext leftctx
---@return SubtypeRelation rel
---@return constraintcause cause
function constraintelem:as_constrain_sliced() end
---@return boolean
function constraintelem:is_sliced_leftcall() end
---@return typed, SubtypeRelation, typed, TypecheckingContext, constraintcause
---@return typed arg
---@return SubtypeRelation rel
---@return typed right
---@return TypecheckingContext rightctx
---@return constraintcause cause
function constraintelem:unwrap_sliced_leftcall() end
---@return boolean, typed, SubtypeRelation, typed, TypecheckingContext, constraintcause
---@return boolean
---@return typed arg
---@return SubtypeRelation rel
---@return typed right
---@return TypecheckingContext rightctx
---@return constraintcause cause
function constraintelem:as_sliced_leftcall() end
---@return boolean
function constraintelem:is_leftcall_sliced() end
---@return typed, TypecheckingContext, typed, SubtypeRelation, constraintcause
---@return typed left
---@return TypecheckingContext leftctx
---@return typed arg
---@return SubtypeRelation rel
---@return constraintcause cause
function constraintelem:unwrap_leftcall_sliced() end
---@return boolean, typed, TypecheckingContext, typed, SubtypeRelation, constraintcause
---@return boolean
---@return typed left
---@return TypecheckingContext leftctx
---@return typed arg
---@return SubtypeRelation rel
---@return constraintcause cause
function constraintelem:as_leftcall_sliced() end
---@return boolean
function constraintelem:is_sliced_rightcall() end
---@return SubtypeRelation, typed, TypecheckingContext, typed, constraintcause
---@return SubtypeRelation rel
---@return typed right
---@return TypecheckingContext rightctx
---@return typed arg
---@return constraintcause cause
function constraintelem:unwrap_sliced_rightcall() end
---@return boolean, SubtypeRelation, typed, TypecheckingContext, typed, constraintcause
---@return boolean
---@return SubtypeRelation rel
---@return typed right
---@return TypecheckingContext rightctx
---@return typed arg
---@return constraintcause cause
function constraintelem:as_sliced_rightcall() end
---@return boolean
function constraintelem:is_rightcall_sliced() end
---@return typed, TypecheckingContext, SubtypeRelation, typed, constraintcause
---@return typed left
---@return TypecheckingContext leftctx
---@return SubtypeRelation rel
---@return typed arg
---@return constraintcause cause
function constraintelem:unwrap_rightcall_sliced() end
---@return boolean, typed, TypecheckingContext, SubtypeRelation, typed, constraintcause
---@return boolean
---@return typed left
---@return TypecheckingContext leftctx
---@return SubtypeRelation rel
---@return typed arg
---@return constraintcause cause
function constraintelem:as_rightcall_sliced() end

---@class (exact) constraintelemType: EnumType
Expand Down
14 changes: 10 additions & 4 deletions types/continuation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ function continuation:unwrap_empty() end
function continuation:as_empty() end
---@return boolean
function continuation:is_frame() end
---@return RuntimeContext, typed
---@return RuntimeContext context
---@return typed code
function continuation:unwrap_frame() end
---@return boolean, RuntimeContext, typed
---@return boolean
---@return RuntimeContext context
---@return typed code
function continuation:as_frame() end
---@return boolean
function continuation:is_sequence() end
---@return continuation, continuation
---@return continuation first
---@return continuation second
function continuation:unwrap_sequence() end
---@return boolean, continuation, continuation
---@return boolean
---@return continuation first
---@return continuation second
function continuation:as_sequence() end

---@class (exact) continuationType: EnumType
Expand Down
Loading

0 comments on commit 5609a6f

Please sign in to comment.