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

Covariant Returns Feature #35308

Merged
merged 21 commits into from
Jun 1, 2020
Merged

Covariant Returns Feature #35308

merged 21 commits into from
Jun 1, 2020

Commits on Apr 22, 2020

  1. Covariant Returns Feature: Allowing return types on MethodImpl to be …

    …derived types of the return type on the MethodDecl.
    
    Feature limitations:
      - Only supports MethodImpls and MethodDecls on classes (no interfaces/valuetypes).
      - MethodImpl and MethodDecl cannot be on the same type.
      - Interface/valuetypes not supported as covariant return types.
    
    Changes are mostly a boolean flag being passed around to allow for covariant type checking in method signatures.
    Generics are handled by correctly keeping track of the substitution chain while traversing the base type hierarchy for type comparison.
    
    All method signature comparisons uses metadata for checking, without loading any type (with some exceptions).
    
    Validation for the `ValidateMethodImplRemainsInEffectAttribute` is performed at the very last step of `CLASS_LOAD_EXACTPARENTS`.
    
    Inludes unit tests to cover positive/negative scenarios:
      - Non-generics
      - Generics, with various levels of complexities on generic instantiations and substitutions
      - GVMs
      - Delegates
      - Tests for validation of the existance/absence of the ValidateMethodImplRemainsInEffectAttribute
      - Interface and valuetype scenarios (negative scenarios)
    Fadi Hanna committed Apr 22, 2020
    Configuration menu
    Copy the full SHA
    bf7501f View commit details
    Browse the repository at this point in the history
  2. Adding the missing .ctor methods to the various types

    Fadi Hanna committed Apr 22, 2020
    Configuration menu
    Copy the full SHA
    fef49b2 View commit details
    Browse the repository at this point in the history
  3. Perform covariant return signature matching only after an exact match…

    … fails
    
    Fix a couple of issues in IL tests
    Fadi Hanna committed Apr 22, 2020
    Configuration menu
    Copy the full SHA
    f10119d View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2020

  1. Configuration menu
    Copy the full SHA
    8d5d87e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a14af6f View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2020

  1. Moving covariant return type checking to the final stage of type load…

    …ing, and use CanCastTo instead of signature-based checking, to be allow for type compatibility based on ECMA I.8.7.1.
    
    Fixed behavior of the ValidateMethodImplRemainsInEffectAttribute.
    
    Updates to tests
    Fadi Hanna committed Apr 29, 2020
    Configuration menu
    Copy the full SHA
    0e4e472 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    698eafb View commit details
    Browse the repository at this point in the history
  3. Add test coverage for interface cases.

    Fixed an assert
    Fadi Hanna committed Apr 29, 2020
    Configuration menu
    Copy the full SHA
    6848c40 View commit details
    Browse the repository at this point in the history

Commits on Apr 30, 2020

  1. Configuration menu
    Copy the full SHA
    5a85da8 View commit details
    Browse the repository at this point in the history
  2. Small test fixes

    Fadi Hanna committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    89bb5c3 View commit details
    Browse the repository at this point in the history
  3. Fix consistency issue with the way the RequireMethodImplToRemainInEff…

    …ectAttribute is declared
    Fadi Hanna committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    cbecf78 View commit details
    Browse the repository at this point in the history

Commits on May 4, 2020

  1. Support covariant returns and slot unifications in crossgen2

    These changes fix the behavior of the devirtualization algorithm to not incorrectly devirtualize covariant return methods that have the slot unification attribute
    Fadi Hanna committed May 4, 2020
    Configuration menu
    Copy the full SHA
    1154b90 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2020

  1. some CR feedback

    Fadi Hanna committed May 5, 2020
    Configuration menu
    Copy the full SHA
    f97b9de View commit details
    Browse the repository at this point in the history

Commits on May 7, 2020

  1. Add unit test coverage for delegates

    Fadi Hanna committed May 7, 2020
    Configuration menu
    Copy the full SHA
    1329fea View commit details
    Browse the repository at this point in the history

Commits on May 14, 2020

  1. Fix handling of covariant and contravariant generic interfaces

    Also add tests for those.
    janvorli committed May 14, 2020
    Configuration menu
    Copy the full SHA
    997074f View commit details
    Browse the repository at this point in the history

Commits on May 18, 2020

  1. Added test cases to interfaces unit test

    Based on PR feedback, I've added test cases to verify the load level
    asserts change.
    janvorli committed May 18, 2020
    Configuration menu
    Copy the full SHA
    ed9fb4c View commit details
    Browse the repository at this point in the history

Commits on May 20, 2020

  1. Fix Nullable handling and add more tests

    The attempt to overload method with int32 return value by a method with
    Nullable<int32> was asserting in CanCastTo. This change fixes it by
    pre-checking this case before calling into CanCastTo.
    I've also slightly refactored the
    ValidateMethodsWithCovariantReturnTypes by extracting the
    compatible-with stuff into IsCompatibleWith method.
    
    Added tests to test various compatible-with differences from the
    originally used CanCastTo
    janvorli committed May 20, 2020
    Configuration menu
    Copy the full SHA
    6eaaa1a View commit details
    Browse the repository at this point in the history

Commits on May 22, 2020

  1. Configuration menu
    Copy the full SHA
    688c263 View commit details
    Browse the repository at this point in the history

Commits on May 26, 2020

  1. Reflect PR feedback

    - Change the CompatibleWithTest to call virtual methods on test
    classes instead of just instantiating the classes.
    - Update crossgen2 similar to the runtime to have IsCompatibleWith
    method doing the same pre-filtering before calling CanCastTo.
    janvorli committed May 26, 2020
    Configuration menu
    Copy the full SHA
    3636d03 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2020

  1. Configuration menu
    Copy the full SHA
    c05f075 View commit details
    Browse the repository at this point in the history
  2. Disable covariant returns tests on Mono for now

    The mono doesn't implement the feature yet
    janvorli committed Jun 1, 2020
    Configuration menu
    Copy the full SHA
    7ccd3ed View commit details
    Browse the repository at this point in the history