diff --git a/dev/TODO.txt b/dev/TODO.txt index 57f7a8543..55ffa53dd 100644 --- a/dev/TODO.txt +++ b/dev/TODO.txt @@ -153,6 +153,7 @@ - A debugging mode where a breakpoint can be set when the programming is already running? Would be expensive to have a breakpoint check between every statement.. But this would enable traditional step by step debugging. + - tracepoint: like breakpoint, but automatic continue and the UI stays live.. for debugging values changing over time. - Inline structs, further improvements: - These were immutable in the past, because values were shared by pointer, but now there diff --git a/dev/src/lobster/typecheck.h b/dev/src/lobster/typecheck.h index 16a87d176..6947af4e4 100644 --- a/dev/src/lobster/typecheck.h +++ b/dev/src/lobster/typecheck.h @@ -333,8 +333,10 @@ struct TypeChecker { if (et->t == V_UNDEFINED) goto error; return st.Wrap(et, V_VECTOR, err ? &err->line : nullptr); } - if (at->t == V_NIL && bt->t == V_NIL) { - auto et = Union(at->Element(), bt->Element(), aname, bname, CF_NONE, nullptr); + if (at->t == V_NIL || bt->t == V_NIL) { + at = at->ElementIfNil(); + bt = bt->ElementIfNil(); + auto et = Union(at, bt, aname, bname, CF_NONE, nullptr); if (et->t == V_UNDEFINED) goto error; return st.Wrap(et, V_NIL, err ? &err->line : nullptr); } @@ -3763,6 +3765,7 @@ bool Switch::Terminal(TypeChecker &tc) const { if (cas->pattern->children.empty()) have_default = true; if (!cas->cbody->Terminal(tc)) return false; } + // FIXME: this should return true if the switch is proven exhaustive for types, sadly cannot guarantee that with enums. return have_default; }