-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow applying a CallConvention attribute to a lib declaration. Fixes #…
- Loading branch information
Ary Borenszweig
committed
Nov 26, 2016
1 parent
2a273e6
commit afe8bb6
Showing
4 changed files
with
96 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -485,47 +485,6 @@ describe "Semantic: proc" do | |
)) { int32 } | ||
end | ||
|
||
it "specifies a call convention" do | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lbguilherme
Contributor
|
||
result = semantic(%( | ||
lib LibFoo | ||
@[CallConvention("X86_StdCall")] | ||
fun foo : Int32 | ||
end | ||
)) | ||
foo = result.program.types["LibFoo"].lookup_first_def("foo", nil).as(External) | ||
foo.call_convention.should eq(LLVM::CallConvention::X86_StdCall) | ||
end | ||
|
||
it "errors if wrong number of arguments for CallConvention" do | ||
assert_error %( | ||
lib LibFoo | ||
@[CallConvention("X86_StdCall", "bar")] | ||
fun foo : Int32 | ||
end | ||
), | ||
"wrong number of arguments for attribute CallConvention (given 2, expected 1)" | ||
end | ||
|
||
it "errors if CallConvention argument is not a string" do | ||
assert_error %( | ||
lib LibFoo | ||
@[CallConvention(1)] | ||
fun foo : Int32 | ||
end | ||
), | ||
"argument to CallConvention must be a string" | ||
end | ||
|
||
it "errors if CallConvention argument is not a valid string" do | ||
assert_error %( | ||
lib LibFoo | ||
@[CallConvention("foo")] | ||
fun foo : Int32 | ||
end | ||
), | ||
"invalid call convention. Valid values are #{LLVM::CallConvention.values.join ", "}" | ||
end | ||
|
||
it "types proc literal with a type that was never instantiated" do | ||
assert_type(%( | ||
require "prelude" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why remove tests for
fun
when they still can define their ownCallConvention
?