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

Fix self restriction with including generic module #3972

Merged

Commits on Mar 23, 2017

  1. Fix self restriction with including generic module

    Ref: crystal-lang#3847
    
    Now, we can get a compile error with such a code:
    
        module Foo(T)
          def foo(x : T)
            x
          end
        end
    
        abstract struct Bar
          include Foo(self)
        end
    
        struct Baz1 < Bar
        end
    
        struct Baz2 < Bar
        end
    
        Baz1.new.foo Baz2.new # => no overload matches 'Baz1#foo' with type Baz2
    
    This commit adds `lazy_self` parameter to `lookup_type`. When `lazy_self`
    is `true`, `lookup_type` keeps `self` in generics type. It is used to
    look up type for `include` and `extend`.
    makenowjust authored and Brian J. Cardiff committed Mar 23, 2017
    Configuration menu
    Copy the full SHA
    6645b8f View commit details
    Browse the repository at this point in the history
  2. Add TODO for fixing self restriction

    Because old compiler wants this definition and CI uses old compiler...
    makenowjust authored and Brian J. Cardiff committed Mar 23, 2017
    Configuration menu
    Copy the full SHA
    8ace6d4 View commit details
    Browse the repository at this point in the history