lang: ast, interfaces: Improve speculation safety checks

We want to speculate in more cases, so make sure that speculation is
safe!
This commit is contained in:
James Shubin
2025-03-06 16:53:57 -05:00
parent aea894a706
commit f87c550be1
2 changed files with 19 additions and 0 deletions

View File

@@ -36,8 +36,16 @@ import (
const (
// ErrTypeCurrentlyUnknown is returned from the Type() call on Expr if
// unification didn't run successfully and the type isn't obvious yet.
// Note that it is perfectly legal to return any error, but this one can
// be used instead of inventing your own.
ErrTypeCurrentlyUnknown = util.Error("type is currently unknown")
// ErrValueCurrentlyUnknown is returned from the Value() call on Expr if
// we're speculating and we don't know a value statically. Note that it
// is perfectly legal to return any error, but this one can be used
// instead of inventing your own.
ErrValueCurrentlyUnknown = util.Error("value is currently unknown")
// ErrExpectedFileMissing is returned when a file that is used by an
// import is missing. This might signal the downloader, or it might
// signal a permanent error.