expose top level subtyping functions
[hiphop-php.git] / hphp / hack / src / rupro / hackrs / subtyping / oracle.rs
blob2a97f4ae79908c55efdd00d905cae3a1c2c98fc3
1 // Copyright (c) Meta Platforms, Inc. and affiliates.
2 //
3 // This source code is licensed under the MIT license found in the
4 // LICENSE file in the "hack" directory of this source tree.
6 use crate::{typing::typing_error::Result, typing_decl_provider::Class};
7 use pos::TypeName;
8 use std::{fmt::Debug, rc::Rc};
9 use ty::reason::Reason;
10 pub trait Oracle<R: Reason>: Debug {
11     /// Get a class, return `None` if it can't be found.
12     fn get_class(&self, name: TypeName) -> Result<Option<Rc<dyn Class<R>>>>;
15 #[derive(Debug)]
16 pub struct NoClasses;
18 impl<R: Reason> Oracle<R> for NoClasses {
19     fn get_class(&self, _name: TypeName) -> Result<Option<Rc<dyn Class<R>>>> {
20         Ok(None)
21     }