diff --git a/build/ultratiny.flx b/build/ultratiny.flx index 138e51a0..67de758b 100644 --- a/build/ultratiny.flx +++ b/build/ultratiny.flx @@ -86,20 +86,25 @@ class B : A // issue #0: we basically don't really even check for overriding methods properly. // issue #1: co/contra-variance of return and parameter types for virtual methods -// issue #2: crashes when initialisers have default arguments?? +// issue #2: crashes when functions have default arguments?? // classes are a Bad Idea (tm) ): -struct Tmp +class Tmp { - k: int - m: int + var z: int - fn meth() -> int => k * m + init(x: int = 3, y: int = 7) + { + this.z = x * y + } } + @entry fn main() { + fn foo(x: int = 3, y: int = 7) -> int => x * y + // let a = B() // let q = a.foo(Y(c: 1)).data @@ -109,6 +114,8 @@ struct Tmp // let q = Tmp(k: 3, m: 7).meth() // let q = B().foo(Y(c: 1)).data + + let q = foo(x: 7) std::io::println("thing: %", q) } diff --git a/source/codegen/call.cpp b/source/codegen/call.cpp index 3fd41a28..b899f8fc 100644 --- a/source/codegen/call.cpp +++ b/source/codegen/call.cpp @@ -125,7 +125,7 @@ static std::vector _codegenAndArrangeFunctionCallArguments(cgn::Cod for(size_t i = 0; i < argExprs.size(); i++) { // this extra complexity is to ensure we codegen arguments from left-to-right! - auto arg = arguments[i].value; + auto arg = argExprs[i]; auto k = revArgExprs[arg]; auto infer = ft->getArgumentN(k);