Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Truffle] Translate UnsupportedSpecializationException to TypeError r…
…ather than TruffleError.
  • Loading branch information
chrisseaton committed Jan 7, 2015
1 parent 422d460 commit 4a6aa1a
Show file tree
Hide file tree
Showing 40 changed files with 1 addition and 105 deletions.
Expand Up @@ -116,7 +116,7 @@ private RubyException translate(UnsupportedSpecializationException exception) {
}
}

return getContext().getCoreLibrary().internalError(builder.toString(), this);
return getContext().getCoreLibrary().typeError(builder.toString(), this);
}

public RubyException translate(Throwable throwable) {
Expand Down
1 change: 0 additions & 1 deletion spec/truffle/tags/core/array/at_tags.txt
@@ -1,3 +1,2 @@
fails:Array#at tries to convert the passed argument to an Integer using #to_int
fails:Array#at raises a TypeError when the passed argument can't be coerced to Integer

This comment has been minimized.

Copy link
@nirvdrum

nirvdrum Jan 8, 2015

Contributor

Was this a spec that was already passing? It seems raising a TypeError when we haven't attempted to coerce at all would be a false positive.

This comment has been minimized.

Copy link
@chrisseaton

chrisseaton Jan 8, 2015

Author Contributor

The spec seems to imply that no coercion should be attempted - it just looks for an error - it doesn't check that to_int is not called.

This comment has been minimized.

Copy link
@nirvdrum

nirvdrum Jan 8, 2015

Contributor

I guess it's weirdly named then. Thanks for clarifying.

fails:Array#at raises an ArgumentError when 2 or more arguments is passed
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/array/initialize_tags.txt
Expand Up @@ -5,13 +5,11 @@ fails:Array#initialize with no arguments makes the array empty
fails:Array#initialize with no arguments does not use the given block
fails:Array#initialize with (array) does not use the given block
fails:Array#initialize with (array) calls #to_ary to convert the value to an array
fails:Array#initialize with (array) raises a TypeError if an Array type argument and a default object
fails:Array#initialize with (size, object=nil) sets the array to size and fills with nil when object is omitted
fails:Array#initialize with (size, object=nil) raises an ArgumentError if size is negative
fails:Array#initialize with (size, object=nil) raises an ArgumentError if size is too large
fails:Array#initialize with (size, object=nil) calls #to_int to convert the size argument to an Integer when object is given
fails:Array#initialize with (size, object=nil) calls #to_int to convert the size argument to an Integer when object is not given
fails:Array#initialize with (size, object=nil) raises a TypeError if the size argument is not an Integer type
fails:Array#initialize with (size, object=nil) uses the block value instead of using the default value
fails:Array#initialize with (size, object=nil) returns the value passed to break
fails:Array#initialize with (size, object=nil) sets the array to the values returned by the block before break is executed
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/array/join_tags.txt
Expand Up @@ -16,8 +16,6 @@ fails:Array#join fails for arrays with incompatibly-encoded strings
fails:Array#join does not separate elements when the passed separator is nil
fails:Array#join calls #to_str to convert the separator to a String
fails:Array#join does not call #to_str on the separator if the array is empty
fails:Array#join raises a TypeError if the separator cannot be coerced to a String by calling #to_str
fails:Array#join raises a TypeError if passed false as the separator
fails:Array#join with a tainted separator does not taint the result if the array is empty
fails:Array#join with a tainted separator does not taint the result if the array has only one element
fails:Array#join with a tainted separator taints the result if the array has two or more elements
Expand Down
1 change: 0 additions & 1 deletion spec/truffle/tags/core/array/minus_tags.txt
@@ -1,5 +1,4 @@
fails:Array#- tries to convert the passed arguments to Arrays using #to_ary
fails:Array#- raises a TypeError if the argument cannot be coerced to an Array by calling #to_ary
fails:Array#- does not return subclass instance for Array subclasses
fails:Array#- does not call to_ary on array subclasses
fails:Array#- removes an item identified as equivalent via #hash and #eql?
Expand Down
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/array/multiply_tags.txt
@@ -1,8 +1,6 @@
fails:Array#* tries to convert the passed argument to a String using #to_str
fails:Array#* tires to convert the passed argument to an Integer using #to_int
fails:Array#* raises a TypeError if the argument can neither be converted to a string nor an integer
fails:Array#* converts the passed argument to a String rather than an Integer
fails:Array#* raises a TypeError is the passed argument is nil
fails:Array#* with an integer properly handles recursive arrays
fails:Array#* with an integer raises an ArgumentError when passed a negative integer
fails:Array#* with an integer copies the taint status of the original array even if the passed count is 0
Expand Down
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/array/new_tags.txt
Expand Up @@ -3,12 +3,10 @@ fails:Array.new with no arguments returns an empty array
fails:Array.new with no arguments does not use the given block
fails:Array.new with (array) does not use the given block
fails:Array.new with (array) calls #to_ary to convert the value to an array
fails:Array.new with (array) raises a TypeError if an Array type argument and a default object
fails:Array.new with (size, object=nil) returns an array of size filled with nil when object is omitted
fails:Array.new with (size, object=nil) raises an ArgumentError if size is negative
fails:Array.new with (size, object=nil) raises an ArgumentError if size is too large
fails:Array.new with (size, object=nil) calls #to_int to convert the size argument to an Integer when object is given
fails:Array.new with (size, object=nil) calls #to_int to convert the size argument to an Integer when object is not given
fails:Array.new with (size, object=nil) raises a TypeError if the size argument is not an Integer type
fails:Array.new with (size, object=nil) uses the block value instead of using the default value
fails:Array.new with (size, object=nil) returns the value passed to break
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/a_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'A' raises a TypeError when passed nil
fails:Array#pack with format 'A' raises a TypeError when passed an Integer
fails:Array#pack with format 'A' ignores whitespace in the format string
fails:Array#pack with format 'A' calls #to_str to coerce the directives string
fails:Array#pack with format 'A' taints the output string if the format string is tainted
Expand All @@ -17,8 +15,6 @@ fails:Array#pack with format 'A' returns a untrusted string when the format is u
fails:Array#pack with format 'A' returns a untrusted string when the empty format is untrusted
fails:Array#pack with format 'A' returns a untrusted string when a pack argument is untrusted
fails:Array#pack with format 'A' returns a trusted string when the array is untrusted
fails:Array#pack with format 'a' raises a TypeError when passed nil
fails:Array#pack with format 'a' raises a TypeError when passed an Integer
fails:Array#pack with format 'a' ignores whitespace in the format string
fails:Array#pack with format 'a' calls #to_str to coerce the directives string
fails:Array#pack with format 'a' taints the output string if the format string is tainted
Expand Down
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/array/pack/at_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format '@' raises a TypeError when passed nil
fails:Array#pack with format '@' raises a TypeError when passed an Integer
fails:Array#pack with format '@' ignores whitespace in the format string
fails:Array#pack with format '@' calls #to_str to coerce the directives string
fails:Array#pack with format '@' taints the output string if the format string is tainted
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/b_tags.txt
@@ -1,14 +1,10 @@
fails:Array#pack with format 'B' raises a TypeError when passed nil
fails:Array#pack with format 'B' raises a TypeError when passed an Integer
fails:Array#pack with format 'B' ignores whitespace in the format string
fails:Array#pack with format 'B' calls #to_str to coerce the directives string
fails:Array#pack with format 'B' taints the output string if the format string is tainted
fails:Array#pack with format 'B' raises an ArgumentError if there are fewer elements than the format requires
fails:Array#pack with format 'B' raises a TypeError if the object does not respond to #to_str
fails:Array#pack with format 'B' raises a TypeError if #to_str does not return a String
fails:Array#pack with format 'B' calls #to_str to convert an Object to a String
fails:Array#pack with format 'b' raises a TypeError when passed nil
fails:Array#pack with format 'b' raises a TypeError when passed an Integer
fails:Array#pack with format 'b' ignores whitespace in the format string
fails:Array#pack with format 'b' calls #to_str to coerce the directives string
fails:Array#pack with format 'b' taints the output string if the format string is tainted
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/c_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'C' raises a TypeError when passed nil
fails:Array#pack with format 'C' raises a TypeError when passed an Integer
fails:Array#pack with format 'C' ignores whitespace in the format string
fails:Array#pack with format 'C' calls #to_str to coerce the directives string
fails:Array#pack with format 'C' taints the output string if the format string is tainted
Expand All @@ -11,8 +9,6 @@ fails:Array#pack with format 'C' raises a TypeError when the object does not res
fails:Array#pack with format 'C' raises a TypeError when passed a String
fails:Array#pack with format 'C' raises ArgumentError when the format modifier is '_'
fails:Array#pack with format 'C' raises ArgumentError when the format modifier is '!'
fails:Array#pack with format 'c' raises a TypeError when passed nil
fails:Array#pack with format 'c' raises a TypeError when passed an Integer
fails:Array#pack with format 'c' ignores whitespace in the format string
fails:Array#pack with format 'c' calls #to_str to coerce the directives string
fails:Array#pack with format 'c' taints the output string if the format string is tainted
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/d_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'D' raises a TypeError when passed nil
fails:Array#pack with format 'D' raises a TypeError when passed an Integer
fails:Array#pack with format 'D' calls #to_str to coerce the directives string
fails:Array#pack with format 'D' taints the output string if the format string is tainted
fails:Array#pack with format 'D' raises an ArgumentError if there are fewer elements than the format requires
Expand All @@ -11,8 +9,6 @@ fails:Array#pack with format 'D' raises a TypeError if a String does not represe
fails:Array#pack with format 'D' raises a TypeError when the object does not respond to #to_f
fails:Array#pack with format 'D' raises a TypeError if passed a String representation of a floating point number
fails:Array#pack with format 'D' encodes NaN
fails:Array#pack with format 'd' raises a TypeError when passed nil
fails:Array#pack with format 'd' raises a TypeError when passed an Integer
fails:Array#pack with format 'd' calls #to_str to coerce the directives string
fails:Array#pack with format 'd' taints the output string if the format string is tainted
fails:Array#pack with format 'd' raises an ArgumentError if there are fewer elements than the format requires
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/e_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'E' raises a TypeError when passed nil
fails:Array#pack with format 'E' raises a TypeError when passed an Integer
fails:Array#pack with format 'E' calls #to_str to coerce the directives string
fails:Array#pack with format 'E' taints the output string if the format string is tainted
fails:Array#pack with format 'E' raises an ArgumentError if there are fewer elements than the format requires
Expand All @@ -11,8 +9,6 @@ fails:Array#pack with format 'E' raises a TypeError if a String does not represe
fails:Array#pack with format 'E' raises a TypeError when the object does not respond to #to_f
fails:Array#pack with format 'E' raises a TypeError if passed a String representation of a floating point number
fails:Array#pack with format 'E' encodes NaN
fails:Array#pack with format 'e' raises a TypeError when passed nil
fails:Array#pack with format 'e' raises a TypeError when passed an Integer
fails:Array#pack with format 'e' calls #to_str to coerce the directives string
fails:Array#pack with format 'e' taints the output string if the format string is tainted
fails:Array#pack with format 'e' raises an ArgumentError if there are fewer elements than the format requires
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/f_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'F' raises a TypeError when passed nil
fails:Array#pack with format 'F' raises a TypeError when passed an Integer
fails:Array#pack with format 'F' calls #to_str to coerce the directives string
fails:Array#pack with format 'F' taints the output string if the format string is tainted
fails:Array#pack with format 'F' raises an ArgumentError if there are fewer elements than the format requires
Expand All @@ -11,8 +9,6 @@ fails:Array#pack with format 'F' raises a TypeError if a String does not represe
fails:Array#pack with format 'F' raises a TypeError when the object does not respond to #to_f
fails:Array#pack with format 'F' raises a TypeError if passed a String representation of a floating point number
fails:Array#pack with format 'F' encodes NaN
fails:Array#pack with format 'f' raises a TypeError when passed nil
fails:Array#pack with format 'f' raises a TypeError when passed an Integer
fails:Array#pack with format 'f' calls #to_str to coerce the directives string
fails:Array#pack with format 'f' taints the output string if the format string is tainted
fails:Array#pack with format 'f' raises an ArgumentError if there are fewer elements than the format requires
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/g_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'G' raises a TypeError when passed nil
fails:Array#pack with format 'G' raises a TypeError when passed an Integer
fails:Array#pack with format 'G' calls #to_str to coerce the directives string
fails:Array#pack with format 'G' taints the output string if the format string is tainted
fails:Array#pack with format 'G' raises an ArgumentError if there are fewer elements than the format requires
Expand All @@ -11,8 +9,6 @@ fails:Array#pack with format 'G' raises a TypeError if a String does not represe
fails:Array#pack with format 'G' raises a TypeError when the object does not respond to #to_f
fails:Array#pack with format 'G' raises a TypeError if passed a String representation of a floating point number
fails:Array#pack with format 'G' encodes NaN
fails:Array#pack with format 'g' raises a TypeError when passed nil
fails:Array#pack with format 'g' raises a TypeError when passed an Integer
fails:Array#pack with format 'g' calls #to_str to coerce the directives string
fails:Array#pack with format 'g' taints the output string if the format string is tainted
fails:Array#pack with format 'g' raises an ArgumentError if there are fewer elements than the format requires
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/h_tags.txt
@@ -1,14 +1,10 @@
fails:Array#pack with format 'H' raises a TypeError when passed nil
fails:Array#pack with format 'H' raises a TypeError when passed an Integer
fails:Array#pack with format 'H' ignores whitespace in the format string
fails:Array#pack with format 'H' calls #to_str to coerce the directives string
fails:Array#pack with format 'H' taints the output string if the format string is tainted
fails:Array#pack with format 'H' raises an ArgumentError if there are fewer elements than the format requires
fails:Array#pack with format 'H' raises a TypeError if the object does not respond to #to_str
fails:Array#pack with format 'H' raises a TypeError if #to_str does not return a String
fails:Array#pack with format 'H' calls #to_str to convert an Object to a String
fails:Array#pack with format 'h' raises a TypeError when passed nil
fails:Array#pack with format 'h' raises a TypeError when passed an Integer
fails:Array#pack with format 'h' ignores whitespace in the format string
fails:Array#pack with format 'h' calls #to_str to coerce the directives string
fails:Array#pack with format 'h' taints the output string if the format string is tainted
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/i_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'I' raises a TypeError when passed nil
fails:Array#pack with format 'I' raises a TypeError when passed an Integer
fails:Array#pack with format 'I' ignores whitespace in the format string
fails:Array#pack with format 'I' calls #to_str to coerce the directives string
fails:Array#pack with format 'I' taints the output string if the format string is tainted
Expand All @@ -8,8 +6,6 @@ fails:Array#pack with format 'I' raises a TypeError when passed true
fails:Array#pack with format 'I' raises a TypeError when passed false
fails:Array#pack with format 'I' raises a TypeError when the object does not respond to #to_int
fails:Array#pack with format 'I' raises a TypeError when passed a String
fails:Array#pack with format 'i' raises a TypeError when passed nil
fails:Array#pack with format 'i' raises a TypeError when passed an Integer
fails:Array#pack with format 'i' ignores whitespace in the format string
fails:Array#pack with format 'i' calls #to_str to coerce the directives string
fails:Array#pack with format 'i' taints the output string if the format string is tainted
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/l_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'L' raises a TypeError when passed nil
fails:Array#pack with format 'L' raises a TypeError when passed an Integer
fails:Array#pack with format 'L' ignores whitespace in the format string
fails:Array#pack with format 'L' calls #to_str to coerce the directives string
fails:Array#pack with format 'L' taints the output string if the format string is tainted
Expand All @@ -8,8 +6,6 @@ fails:Array#pack with format 'L' raises a TypeError when passed true
fails:Array#pack with format 'L' raises a TypeError when passed false
fails:Array#pack with format 'L' raises a TypeError when the object does not respond to #to_int
fails:Array#pack with format 'L' raises a TypeError when passed a String
fails:Array#pack with format 'l' raises a TypeError when passed nil
fails:Array#pack with format 'l' raises a TypeError when passed an Integer
fails:Array#pack with format 'l' ignores whitespace in the format string
fails:Array#pack with format 'l' calls #to_str to coerce the directives string
fails:Array#pack with format 'l' taints the output string if the format string is tainted
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/m_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'M' raises a TypeError when passed nil
fails:Array#pack with format 'M' raises a TypeError when passed an Integer
fails:Array#pack with format 'M' ignores whitespace in the format string
fails:Array#pack with format 'M' calls #to_str to coerce the directives string
fails:Array#pack with format 'M' taints the output string if the format string is tainted
Expand All @@ -9,8 +7,6 @@ fails:Array#pack with format 'M' calls #to_s to convert an object to a String
fails:Array#pack with format 'M' converts the object to a String representation if #to_s does not return a String
fails:Array#pack with format 'M' encodes a Symbol as a String
fails:Array#pack with format 'M' encodes an Integer as a String
fails:Array#pack with format 'm' raises a TypeError when passed nil
fails:Array#pack with format 'm' raises a TypeError when passed an Integer
fails:Array#pack with format 'm' ignores whitespace in the format string
fails:Array#pack with format 'm' calls #to_str to coerce the directives string
fails:Array#pack with format 'm' taints the output string if the format string is tainted
Expand Down
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/pack/n_tags.txt
@@ -1,5 +1,3 @@
fails:Array#pack with format 'N' raises a TypeError when passed nil
fails:Array#pack with format 'N' raises a TypeError when passed an Integer
fails:Array#pack with format 'N' ignores whitespace in the format string
fails:Array#pack with format 'N' calls #to_str to coerce the directives string
fails:Array#pack with format 'N' taints the output string if the format string is tainted
Expand All @@ -11,8 +9,6 @@ fails:Array#pack with format 'N' raises a TypeError when passed a String
fails:Array#pack with format 'N' raises ArgumentError when the format modifier is '_'
fails:Array#pack with format 'N' raises ArgumentError when the format modifier is '!'
fails:Array#pack with format 'N' calls #to_int to convert the pack argument to an Integer
fails:Array#pack with format 'n' raises a TypeError when passed nil
fails:Array#pack with format 'n' raises a TypeError when passed an Integer
fails:Array#pack with format 'n' ignores whitespace in the format string
fails:Array#pack with format 'n' calls #to_str to coerce the directives string
fails:Array#pack with format 'n' taints the output string if the format string is tainted
Expand Down

0 comments on commit 4a6aa1a

Please sign in to comment.