Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google sync #1019

Merged
merged 8 commits into from Oct 4, 2021
Merged

Google sync #1019

merged 8 commits into from Oct 4, 2021

Commits on Oct 4, 2021

  1. Merge BaseValue.cls and BaseValue.get_class().

    This simplifies abstract.py by merging the cls attribute and the get_class()
    method into a single cls attribute. Previously, for a class X without an
    explicit metaclass, X.cls == None and x.get_class() == Type[X]. Now,
    X.cls == Type[X]. Other differences:
    * cls can no longer be None. This lets us get rid of a lot of `if cls` checks.
    * For SimpleValue and ParameterizedClass, cls is evaluated lazily using a
      property and a private attribute. This is done because trying to access
      attributes like vm.convert.type_type before they're defined leads to
      problems. I added a vm.convert.minimally_initialized attribute so that the
      cls property can determine when it's safe to access convert attributes.
    
    Also fixes an abstract classmethod bug exposed by this change.
    
    Where possible, I have tried to keep user-visible behavior the same as before,
    even in cases in which I'm not sure the previous behavior was correct (see the
    new TODO in matcher.py), since this is already a pretty complicated change. The
    one thing I did change was that the types of classes are now inferred as `type`
    rather than `Any` more often, since the case in which the type became `Any` due
    to cls being None no longer exists.
    
    PiperOrigin-RevId: 399973506
    rchen152 committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    e6f5251 View commit details
    Browse the repository at this point in the history
  2. Allow enum members in Literals.

    We still allow unsolvables, because enum members will continue to show up as those until the overlay is enabled.
    
    PiperOrigin-RevId: 400070986
    Solumin authored and rchen152 committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    89d9e32 View commit details
    Browse the repository at this point in the history
  3. Rename annotations_util to annotation_utils.

    Every other utility module we have is named x_utils, so changing the name of
    this one makes it easier to remember.
    
    PiperOrigin-RevId: 400134359
    rchen152 committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    2bef63f View commit details
    Browse the repository at this point in the history
  4. Disable enum equality checks and don't use atomic strings for canonic…

    …al names.
    
    - Enum equality checks were breaking some targets due to [].
    - Using atomic strings for the names of canonical enum instances leads to very weird error messages where the lookup fails due to the name being `''`. (See the new test for an example.)
    
    PiperOrigin-RevId: 400247284
    Solumin authored and rchen152 committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    32448f8 View commit details
    Browse the repository at this point in the history
  5. Add a separate logger for debug tracing.

    * Adds the trace.* logger hierarchy
    * Adds a context manager to turn on tracing for a block of code
    * Adds a decorator to trace a function's args and return value
    
    PiperOrigin-RevId: 400313706
    martindemello authored and rchen152 committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    bc6881b View commit details
    Browse the repository at this point in the history
  6. Check Instance.maybe_missing_members earlier during attribute access.

    maybe_missing_members needs to be checked before calling __getattr__, since a
    missing member may have a different type from the __getattr__ fallback.
    
    PiperOrigin-RevId: 400457631
    rchen152 committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    d7afc20 View commit details
    Browse the repository at this point in the history
  7. Fix a bug in matching callables with TypeVar parameters.

    As it turns out, we already have a Matcher._get_param_matcher() method for
    solving the exact problem with bounded TypeVars encountered in the attr stubs;
    we just need to remember to use it when matching a Callable instance against a
    Callable. (Previously, it was only used when matching an actual function
    against a Callable.)
    
    PiperOrigin-RevId: 400457695
    rchen152 committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    e798285 View commit details
    Browse the repository at this point in the history
  8. Prepare a PyPI release.

    PiperOrigin-RevId: 400778002
    rchen152 committed Oct 4, 2021
    Configuration menu
    Copy the full SHA
    300a3d3 View commit details
    Browse the repository at this point in the history