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
We have a pattern where we want to error any time someone uses a banned method:
Standalone code, or other way to reproduce the problem
abstractclassResult {
abstractpublicfunctiongetOne(): string;
abstractpublicfunctiongetOther(): string;
}
finalclassResultErrorextendsResult {
publicfunctiongetOne(): noreturn { thrownew\Exception('bad'); }
// ^ The method `foo` is not compatible with the overridden method (Typing[4341])publicfunctiongetOther(): nothing { thrownew\Exception('bad'); }
// this is allowed
}
functiondoThing(ResultError$result): void {
echo$result->getOne();
// ^ You are using the return value of a `noreturn` function (Typing[4133])
}
functiondoOtherThing(ResultError$result): void {
echo$result->getOther();
// this is allowed
}
Expected behavior
Error when using value from nothing-returning function or method
Optional-extra: Allow noreturn to act as the bottom type
Environment
Operating system: Docker Ubuntu
Installation method: hhvm/hhvm on dockerhub'
HHVM Version: 4.149.0-dev (rel) (non-lowptr)
The text was updated successfully, but these errors were encountered:
Describe the bug
We have a pattern where we want to error any time someone uses a banned method:
Standalone code, or other way to reproduce the problem
Expected behavior
Error when using value from
nothing
-returning function or methodOptional-extra: Allow
noreturn
to act as the bottom typeEnvironment
The text was updated successfully, but these errors were encountered: