Closed wnats closed 11 months ago
Compiling this also yields the same error msg, with the same resolution (in this case replace color
with ll.color
)
constructors (T) empty | cons(head:T, tail:_(T))
type color {
pub red | blk
}
def prepend(elt:T, xs:_(T)):_(T) = cons(elt, xs)
?xs:_(color) = empty
?ys = prepend(red, xs)
If color
is defined in a separate module in the same directory, this would've worked
It seems not all int
s are resolved to wybe.int
======================================================================
AFTER TYPE CHECK:
Module ll(T)
representation : address
public submods :
public resources:
public procs : ll.<0>
imports : use wybe
resources :
procs :
module top-level code > public {semipure} (0 calls)
0: () use !wybe.io.io:
ll.<0>empty(?tmp#0:ll(wybe.int) @ll:5:14)
foreign llvm move(tmp#0:ll(wybe.int), ?xs:ll(int) @ll:5:2)
ll.<0>prepend(1:wybe.int @ll:6:15, xs:ll(int) @ll:6:18, ?tmp#1:ll(wybe.int) @ll:6:7)
foreign llvm move(tmp#1:ll(wybe.int), ?ys:ll(wybe.int) @ll:6:2)
The root problem seems to lie in lookupType'
when the type name is _
https://github.com/pschachte/wybe/blob/49bf8540148e5a55a905123a9836e6a392e5775e/src/AST.hs#L943-L946
where it does not resolve args
as follows
https://github.com/pschachte/wybe/blob/49bf8540148e5a55a905123a9836e6a392e5775e/src/AST.hs#L957-L975
Will do the fix shortly
Compiling
ll.wybe
yields
This is resolved by:
_
withll
int
withwybe.int
prepend
call:_(int)