Skip to content
Permalink
Browse files
Fix: missing path lookup through alias. Fixes #4645
  • Loading branch information
asterite authored and Martin Verzilli committed Sep 16, 2017
1 parent 49f9d28 commit 5c27083a8bc2af86070597043623842b84dc27ac
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
@@ -264,4 +264,28 @@ describe "Semantic: alias" do
Baz::Bar.baz
)) { int32 }
end

it "finds type through alias (#4645)" do
assert_type(%(
module FooBar
module Foo
A = 10
end
module Bar
include Foo
end
end
class Baz
alias Bar = FooBar::Bar
def test
Bar::A
end
end
Baz.new.test
)) { int32 }
end
end
@@ -141,6 +141,16 @@ module Crystal
end
end

class AliasType
def lookup_path_item(name : String, lookup_in_namespace, include_private, location)
if aliased_type = aliased_type?
aliased_type.lookup_path_item(name, lookup_in_namespace, include_private, location)
else
super
end
end
end

class TypeDefType
delegate lookup_path, to: typedef
end

0 comments on commit 5c27083

Please sign in to comment.