summaryrefslogtreecommitdiff
path: root/test/prism/errors_test.rb
AgeCommit message (Collapse)Author
2023-12-16Revert all of commits after Prism 0.19.0 releaseHiroshi SHIBATA
We should bundle released version of Prism for Ruby 3.3.0
2023-12-15[ruby/prism] Add an error for `in` keyword in argumentsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/2026 https://github.com/ruby/prism/commit/c4b41cd477
2023-12-14[ruby/prism] Make equality operators non-associativeTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/2073 https://github.com/ruby/prism/commit/0f747d9240
2023-12-12[ruby/prism] Update tests and snapshotsUfuk Kayserilioglu
https://github.com/ruby/prism/commit/0663e2bcfa
2023-12-11[ruby/prism] Fix parsing unterminated empty string `"`TSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/2034 https://github.com/ruby/prism/commit/8280e577fa
2023-12-11[ruby/prism] Fix to parse a (endless-)range with binary operatorsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/2022 Fix https://github.com/ruby/prism/pull/2030 https://github.com/ruby/prism/commit/b78d8b6525
2023-12-10[ruby/prism] fix: escape newlineAlex Koval
https://github.com/ruby/prism/commit/a28b427dcc
2023-12-08[ruby/prism] Add necessary encoding flags for symbols and regexKevin Newton
This doesn't actually fix the encodings for symbols and regex, unfortunately. But I wanted to get this change in because it is the last AST change we're going to make before 3.3 is released. So, if consumers want, they can start to check these flags to determine the encoding, even though it will be wrong. Then once we actually set them correctly, everything should work. https://github.com/ruby/prism/commit/9b35f7e891
2023-12-08[ruby/prism] More closely match CRuby error messagesKevin Newton
https://github.com/ruby/prism/commit/1ed07a0c6d
2023-12-06[ruby/prism] Emit error for constant assignments in defsHaldun Bayhantopcu
https://github.com/ruby/prism/commit/864b06f90e
2023-12-06[ruby/prism] Simplify unterminated stringKevin Newton
https://github.com/ruby/prism/commit/ef512ca914
2023-12-06[ruby/prism] Move flag position consistently to frontKevin Newton
https://github.com/ruby/prism/commit/6e69a81737
2023-12-06[ruby/prism] Fix closing loc for string literalsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1974 https://github.com/ruby/prism/commit/453d403593
2023-12-06[ruby/prism] Provide flags for changing encodingsKevin Newton
https://github.com/ruby/prism/commit/e838eaff6f
2023-12-06[ruby/prism] Add locals_body_index to DefNode, BlockNode, LambdaNodeJemma Issroff
The locals_body_index gives the index in the locals array where the locals from the body start. This allows compilers to easily index past the parameters in the locals array. https://github.com/ruby/prism/commit/5d4627b890
2023-12-05[ruby/prism] Add test casesTSUYUSATO Kitsune
https://github.com/ruby/prism/commit/e91f8dbb99
2023-12-05[ruby/prism] Fix some corner casesTSUYUSATO Kitsune
https://github.com/ruby/prism/commit/d5453f168e
2023-12-05[ruby/prism] Fix to parse command-style method calls more correctlyTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1468 Fix https://github.com/ruby/prism/pull/1575 To decide command-style method calls are allowed, this introduce a new parameter `accepts_command_call` to `parse_expression` and some functions. Although one think this can be solved by operator precedence, it is hard or impossible, because the precedence of command-style calls is skewed (e.g. `! bar 1 ` is accepted, but `foo = ! bar 1` is rejected.) One of the most complex examples is that: (1) even though `foo = bar = baz 1` and `foo, bar = baz 1` is accepted, (2) `foo, bar = baz = fuzz 1` is rejected. To implement this behavior, this introduces a new binding power `PM_BINDING_POWER_MULTI_ASSIGNMENT` and uses it for distinguish which single assignments or multi assignments at their RHS. https://github.com/ruby/prism/commit/d4dd49ca81
2023-12-04[ruby/prism] Check "void value expression" for array literalsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1978 https://github.com/ruby/prism/commit/194c997d0a
2023-12-01[ruby/prism] Change numbered parametersKevin Newton
Previously numbered parameters were a field on blocks and lambdas that indicated the maximum number of numbered parameters in either the block or lambda, respectively. However they also had a parameters field that would always be nil in these cases. This changes it so that we introduce a NumberedParametersNode that goes in place of parameters, which has a single uint8_t maximum field on it. That field contains the maximum numbered parameter in either the block or lambda. As a part of the PR, I'm introducing a new UInt8Field type that can be used on nodes, which is just to make it a little more explicit what the maximum values can be (the maximum is actually 9, since it only goes up to _9). Plus we can do a couple of nice things in serialization like just read a single byte. https://github.com/ruby/prism/commit/2d87303903
2023-12-01[ruby/prism] Improve to handle unterminated stringsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1946 This fixes to set an error position for unterminated strings to the opening delimiters. Previously, the error position was set to the end of the delimiter. The same fix applies to other string-like literals. Additionally, this fixes https://github.com/ruby/prism/pull/1946; that is, it adds the last part of the string even though the string literal does not terminate. https://github.com/ruby/prism/commit/c1240baafd
2023-11-29[ruby/prism] Reject class/module defs in method params/rescue/ensure/elseTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1936 https://github.com/ruby/prism/commit/232e77a003
2023-11-28[ruby/prism] Add numbered_parameters field to BlockNode and LambdaNodeJemma Issroff
We are aware at parse time how many numbered parameters we have on a BlockNode or LambdaNode, but prior to this commit, did not store that information anywhere in its own right. The numbered parameters were stored as locals, but this does not distinguish them from other locals that have been set, for example in `a { b = 1; _1 }` there is nothing on the AST that distinguishes b from _1. Consumers such as the compiler need to know information about how many numbered parameters exist to set up their own tables around parameters. Since we have this information at parse time, we should compute it here, instead of deferring the work later on. https://github.com/ruby/prism/commit/bf4a1e124d
2023-11-28[ruby/prism] Fix testsTSUYUSATO Kitsune
https://github.com/ruby/prism/commit/1e6ecbaf04
2023-11-28[ruby/prism] Use `0` for the default valie of `current_param_name`TSUYUSATO Kitsune
https://github.com/ruby/prism/commit/896915de24
2023-11-28[ruby/prism] Check circular references in default values of paramsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1637 https://github.com/ruby/prism/commit/0172d69cba
2023-11-28[ruby/prism] Use un-capitalized error messagesKevin Newton
I don't prefer this style, but it appears that a plurality of syntax error messages between with un-capitalized messages in CRuby, so we'll go with that for consistency, for now. https://github.com/ruby/prism/commit/b02df68954
2023-11-27[ruby/prism] Check void expressions for constant pathsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1920 https://github.com/ruby/prism/commit/ee8e03bac7
2023-11-27[ruby/prism] Fix and reuse pm_call_node_index_pTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1925 Fix https://github.com/ruby/prism/pull/1927 Previously pm_call_node_index_p does not check about a block argument correctly and is not used in parse_write to check an index call node. This commit fixes these problems. https://github.com/ruby/prism/commit/92bab044ff
2023-11-22[ruby/prism] Check void values in singleton class (`class <<`)TSUYUSATO Kitsune
Follow up the ruby/ruby#8917 change. https://github.com/ruby/prism/commit/f6bac4d3bf
2023-11-22[ruby/prism] Fix associativity of binary range with begin-less rangeTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1828 https://github.com/ruby/prism/commit/22c0640e48
2023-11-22[ruby/prism] Reject statements at non-statement posisionsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1547 https://github.com/ruby/prism/commit/cdb643aeab
2023-11-22[ruby/prism] Move CallNode#name field between receiver and argumentsBenoit Daloze
* The same order as in source code. * CallOrWriteNode, CallOperatorWriteNode, CallAndWriteNode already have the correct order so it was also inconsistent with them. https://github.com/ruby/prism/commit/4434e4bc22
2023-11-21[ruby/prism] Fix `..` and `...` to be non-associativeHiroya Fujinami
(https://github.com/ruby/prism/pull/1837) Fix https://github.com/ruby/prism/pull/1829 https://github.com/ruby/prism/commit/90b0b1974c Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2023-11-21[ruby/prism] Warning for ENDs in methodsHaldun Bayhantopcu
(https://github.com/ruby/prism/pull/1899) https://github.com/ruby/prism/commit/1b41c2d56c
2023-11-21[ruby/prism] Check a token after targets more strictlyHiroya Fujinami
(https://github.com/ruby/prism/pull/1878) Fix https://github.com/ruby/prism/pull/1832 https://github.com/ruby/prism/commit/060bcc81a8
2023-11-21[ruby/prism] Build the ability to format errorsKevin Newton
(https://github.com/ruby/prism/pull/1796) Previously, we only supported error messages that were constant strings. This works for the most part, but there are some times where we want to include some part of the source in the error message to make it better. For example, instead of "Token is reserved" it's better to write "_1 is reserved". To do this, we now support allocating error messages at runtime that are built around format strings. https://github.com/ruby/prism/commit/7e6aa17deb
2023-11-21[ruby/prism] Split up CaseNode and CaseMatchNodeKevin Newton
(https://github.com/ruby/prism/pull/1801) https://github.com/ruby/prism/commit/4c1391ea56
2023-11-20[ruby/prism] Disallow defining a numbered parameter methodKevin Newton
(https://github.com/ruby/prism/pull/1797) https://github.com/ruby/prism/commit/c13165e6aa
2023-11-20[ruby/prism] Fix parsing `...` in argumentsHiroya Fujinami
(https://github.com/ruby/prism/pull/1882) * Fix parsing `...` in arguments Fix https://github.com/ruby/prism/pull/1830 Fix https://github.com/ruby/prism/pull/1831 * Rename the constant name to PM_ERR_ARGUMENT_FORWARDING_UNBOUND https://github.com/ruby/prism/pull/1882#discussion_r1398461156 https://github.com/ruby/prism/commit/519653aec2
2023-11-17[ruby/prism] Do not allow trailing commas in calls without parenthesisHaldun Bayhantopcu
https://github.com/ruby/prism/commit/f1d56da58f
2023-11-14Resync prism delete bin/dotKevin Newton
2023-11-14[ruby/prism] Check value expressions on creating a nodeTSUYUSATO Kitsune
https://github.com/ruby/prism/commit/d60948bac3
2023-11-14[ruby/prism] Check value expressions on parsing arguments and assignmentsTSUYUSATO Kitsune
They are corresponding to `arg_value` in `parse.y`. https://github.com/ruby/prism/commit/a4a4834e0d
2023-11-14[ruby/prism] Check value expressions on parsing arguments and assignmentsTSUYUSATO Kitsune
They are corresponding to `arg_value` in `parse.y`. https://github.com/ruby/prism/commit/a4a4834e0d
2023-11-14[ruby/prism] Check value expressions on creating a nodeTSUYUSATO Kitsune
https://github.com/ruby/prism/commit/d60948bac3
2023-11-14[ruby/prism] Check value expressions on parsing arguments and assignmentsTSUYUSATO Kitsune
They are corresponding to `arg_value` in `parse.y`. https://github.com/ruby/prism/commit/a4a4834e0d
2023-11-14[ruby/prism] Add parse_value_expressionTSUYUSATO Kitsune
https://github.com/ruby/prism/commit/37fad74134
2023-11-13[ruby/prism] Add tests for error cases on #1791, #1807, and #1810TSUYUSATO Kitsune
https://github.com/ruby/prism/commit/231e965124
2023-11-10[ruby/prism] Remove extra locals added by ...Kevin Newton
https://github.com/ruby/prism/commit/b7850f2d30