You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yeah, there's currently no flow information going out of scopes. If there was, the assert wouldn't even be necessary, since much = such {} already makes it non-nil.
But yeah, this would require interesting logic, since now we need to basically say, both "branches" of the if come to the same conclusion for a certain variable, so that information can be merged. That would be a new kind of construct in the typechecker.
I guess I haven't run into this much, since the nil checking just makes me religiously try to avoid any nils in my code :)
Rather it only seems to work when it's in the main branch.
This fails:
With
foo.lobster(10): error: type such? does not have field: x
But hoisting the
assert much
works.This has been a contrived example, reduced down from something like:
resource?
fieldif not tex: load()
def load()
method that ends with anassert tex
after having loaded from a fileThe text was updated successfully, but these errors were encountered: