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

Semantic: don't find type parameter in alias #4996

Merged
merged 1 commit into from Sep 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions spec/compiler/semantic/alias_spec.cr
Expand Up @@ -288,4 +288,13 @@ describe "Semantic: alias" do
Baz.new.test
)) { int32 }
end

it "doesn't find type parameter in alias (#3502)" do
assert_error %(
class A(T)
alias B = A(T)
end
),
"undefined constant T"
end
end
4 changes: 3 additions & 1 deletion src/compiler/crystal/types.cr
Expand Up @@ -2375,7 +2375,9 @@ module Crystal
def process_value
return if @value_processed
@value_processed = true
@aliased_type = namespace.lookup_type(@value, allow_typeof: false)
@aliased_type = namespace.lookup_type(@value,
allow_typeof: false,
find_root_generic_type_parameters: false)
end

def includes_type?(other)
Expand Down