Trying to make tests pass again
This commit is contained in:
		| @ -20,7 +20,7 @@ describe('testing AST', () => { | ||||
|             type: 'Literal', | ||||
|             start: 0, | ||||
|             end: 1, | ||||
|             value: { type: 'u_integer', data: 5 }, | ||||
|             value: { type: 'i_integer', data: 5 }, | ||||
|             raw: '5', | ||||
|           }, | ||||
|           operator: '+', | ||||
| @ -28,7 +28,7 @@ describe('testing AST', () => { | ||||
|             type: 'Literal', | ||||
|             start: 3, | ||||
|             end: 4, | ||||
|             value: { type: 'u_integer', data: 6 }, | ||||
|             value: { type: 'i_integer', data: 6 }, | ||||
|             raw: '6', | ||||
|           }, | ||||
|         }, | ||||
| @ -58,7 +58,7 @@ describe('testing AST', () => { | ||||
|               type: 'Literal', | ||||
|               start: 14, | ||||
|               end: 15, | ||||
|               value: { type: 'u_integer', data: 5 }, | ||||
|               value: { type: 'i_integer', data: 5 }, | ||||
|               raw: '5', | ||||
|             }, | ||||
|           }, | ||||
| @ -92,7 +92,7 @@ const newVar = myVar + 1 | ||||
|               type: 'Literal', | ||||
|               start: 14, | ||||
|               end: 15, | ||||
|               value: { type: 'u_integer', data: 5 }, | ||||
|               value: { type: 'i_integer', data: 5 }, | ||||
|               raw: '5', | ||||
|             }, | ||||
|           }, | ||||
| @ -129,7 +129,7 @@ const newVar = myVar + 1 | ||||
|                 type: 'Literal', | ||||
|                 start: 39, | ||||
|                 end: 40, | ||||
|                 value: { type: 'u_integer', data: 1 }, | ||||
|                 value: { type: 'i_integer', data: 1 }, | ||||
|                 raw: '1', | ||||
|               }, | ||||
|             }, | ||||
| @ -320,14 +320,14 @@ const myVar = funcN(1, 2)` | ||||
|                   type: 'Literal', | ||||
|                   start: 58, | ||||
|                   end: 59, | ||||
|                   value: { data: 1, type: 'u_integer' }, | ||||
|                   value: { data: 1, type: 'i_integer' }, | ||||
|                   raw: '1', | ||||
|                 }, | ||||
|                 { | ||||
|                   type: 'Literal', | ||||
|                   start: 61, | ||||
|                   end: 62, | ||||
|                   value: { data: 2, type: 'u_integer' }, | ||||
|                   value: { data: 2, type: 'i_integer' }, | ||||
|                   raw: '2', | ||||
|                 }, | ||||
|               ], | ||||
| @ -390,14 +390,14 @@ describe('testing pipe operator special', () => { | ||||
|                           type: 'Literal', | ||||
|                           start: 32, | ||||
|                           end: 33, | ||||
|                           value: { type: 'u_integer', data: 0 }, | ||||
|                           value: { type: 'i_integer', data: 0 }, | ||||
|                           raw: '0', | ||||
|                         }, | ||||
|                         { | ||||
|                           type: 'Literal', | ||||
|                           start: 35, | ||||
|                           end: 36, | ||||
|                           value: { type: 'u_integer', data: 0 }, | ||||
|                           value: { type: 'i_integer', data: 0 }, | ||||
|                           raw: '0', | ||||
|                         }, | ||||
|                       ], | ||||
| @ -426,14 +426,14 @@ describe('testing pipe operator special', () => { | ||||
|                           type: 'Literal', | ||||
|                           start: 52, | ||||
|                           end: 53, | ||||
|                           value: { type: 'u_integer', data: 2 }, | ||||
|                           value: { type: 'i_integer', data: 2 }, | ||||
|                           raw: '2', | ||||
|                         }, | ||||
|                         { | ||||
|                           type: 'Literal', | ||||
|                           start: 55, | ||||
|                           end: 56, | ||||
|                           value: { type: 'u_integer', data: 3 }, | ||||
|                           value: { type: 'i_integer', data: 3 }, | ||||
|                           raw: '3', | ||||
|                         }, | ||||
|                       ], | ||||
| @ -478,14 +478,14 @@ describe('testing pipe operator special', () => { | ||||
|                                 type: 'Literal', | ||||
|                                 start: 81, | ||||
|                                 end: 82, | ||||
|                                 value: { type: 'u_integer', data: 0 }, | ||||
|                                 value: { type: 'i_integer', data: 0 }, | ||||
|                                 raw: '0', | ||||
|                               }, | ||||
|                               { | ||||
|                                 type: 'Literal', | ||||
|                                 start: 84, | ||||
|                                 end: 85, | ||||
|                                 value: { type: 'u_integer', data: 1 }, | ||||
|                                 value: { type: 'i_integer', data: 1 }, | ||||
|                                 raw: '1', | ||||
|                               }, | ||||
|                             ], | ||||
| @ -536,14 +536,14 @@ describe('testing pipe operator special', () => { | ||||
|                           type: 'Literal', | ||||
|                           start: 121, | ||||
|                           end: 122, | ||||
|                           value: { type: 'u_integer', data: 1 }, | ||||
|                           value: { type: 'i_integer', data: 1 }, | ||||
|                           raw: '1', | ||||
|                         }, | ||||
|                         { | ||||
|                           type: 'Literal', | ||||
|                           start: 124, | ||||
|                           end: 125, | ||||
|                           value: { type: 'u_integer', data: 1 }, | ||||
|                           value: { type: 'i_integer', data: 1 }, | ||||
|                           raw: '1', | ||||
|                         }, | ||||
|                       ], | ||||
| @ -619,7 +619,7 @@ describe('testing pipe operator special', () => { | ||||
|                     type: 'Literal', | ||||
|                     start: 14, | ||||
|                     end: 15, | ||||
|                     value: { type: 'u_integer', data: 5 }, | ||||
|                     value: { type: 'i_integer', data: 5 }, | ||||
|                     raw: '5', | ||||
|                   }, | ||||
|                   operator: '+', | ||||
| @ -627,7 +627,7 @@ describe('testing pipe operator special', () => { | ||||
|                     type: 'Literal', | ||||
|                     start: 18, | ||||
|                     end: 19, | ||||
|                     value: { type: 'u_integer', data: 6 }, | ||||
|                     value: { type: 'i_integer', data: 6 }, | ||||
|                     raw: '6', | ||||
|                   }, | ||||
|                 }, | ||||
| @ -696,7 +696,7 @@ describe('testing pipe operator special', () => { | ||||
|                   type: 'Literal', | ||||
|                   start: 12, | ||||
|                   end: 13, | ||||
|                   value: { type: 'u_integer', data: 1 }, | ||||
|                   value: { type: 'i_integer', data: 1 }, | ||||
|                   raw: '1', | ||||
|                 }, | ||||
|                 { | ||||
| @ -720,7 +720,7 @@ describe('testing pipe operator special', () => { | ||||
|                     type: 'Literal', | ||||
|                     start: 27, | ||||
|                     end: 28, | ||||
|                     value: { type: 'u_integer', data: 4 }, | ||||
|                     value: { type: 'i_integer', data: 4 }, | ||||
|                     raw: '4', | ||||
|                   }, | ||||
|                   operator: '+', | ||||
| @ -728,7 +728,7 @@ describe('testing pipe operator special', () => { | ||||
|                     type: 'Literal', | ||||
|                     start: 31, | ||||
|                     end: 32, | ||||
|                     value: { type: 'u_integer', data: 5 }, | ||||
|                     value: { type: 'i_integer', data: 5 }, | ||||
|                     raw: '5', | ||||
|                   }, | ||||
|                 }, | ||||
| @ -766,7 +766,7 @@ describe('testing pipe operator special', () => { | ||||
|               type: 'Literal', | ||||
|               start: 14, | ||||
|               end: 15, | ||||
|               value: { type: 'u_integer', data: 3 }, | ||||
|               value: { type: 'i_integer', data: 3 }, | ||||
|               raw: '3', | ||||
|             }, | ||||
|           }, | ||||
| @ -825,7 +825,7 @@ describe('testing pipe operator special', () => { | ||||
|                     type: 'Literal', | ||||
|                     start: 47, | ||||
|                     end: 48, | ||||
|                     value: { type: 'u_integer', data: 2 }, | ||||
|                     value: { type: 'i_integer', data: 2 }, | ||||
|                     raw: '2', | ||||
|                   }, | ||||
|                 }, | ||||
| @ -864,7 +864,7 @@ describe('testing pipe operator special', () => { | ||||
|                       type: 'Literal', | ||||
|                       start: 77, | ||||
|                       end: 78, | ||||
|                       value: { type: 'u_integer', data: 4 }, | ||||
|                       value: { type: 'i_integer', data: 4 }, | ||||
|                       raw: '4', | ||||
|                     }, | ||||
|                     operator: '+', | ||||
| @ -872,7 +872,7 @@ describe('testing pipe operator special', () => { | ||||
|                       type: 'Literal', | ||||
|                       start: 81, | ||||
|                       end: 82, | ||||
|                       value: { type: 'u_integer', data: 5 }, | ||||
|                       value: { type: 'i_integer', data: 5 }, | ||||
|                       raw: '5', | ||||
|                     }, | ||||
|                   }, | ||||
| @ -998,7 +998,7 @@ describe('testing pipe operator special', () => { | ||||
|                         type: 'Literal', | ||||
|                         start: 18, | ||||
|                         end: 19, | ||||
|                         value: { type: 'u_integer', data: 1 }, | ||||
|                         value: { type: 'i_integer', data: 1 }, | ||||
|                         raw: '1', | ||||
|                       }, | ||||
|                       { | ||||
| @ -1215,7 +1215,7 @@ describe('nests binary expressions correctly', () => { | ||||
|               type: 'Literal', | ||||
|               start: 11, | ||||
|               end: 12, | ||||
|               value: { type: 'u_integer', data: 1 }, | ||||
|               value: { type: 'i_integer', data: 1 }, | ||||
|               raw: '1', | ||||
|             }, | ||||
|             operator: '+', | ||||
| @ -1223,7 +1223,7 @@ describe('nests binary expressions correctly', () => { | ||||
|               type: 'Literal', | ||||
|               start: 15, | ||||
|               end: 16, | ||||
|               value: { type: 'u_integer', data: 2 }, | ||||
|               value: { type: 'i_integer', data: 2 }, | ||||
|               raw: '2', | ||||
|             }, | ||||
|           }, | ||||
| @ -1263,7 +1263,7 @@ describe('nests binary expressions correctly', () => { | ||||
|                 type: 'Literal', | ||||
|                 start: 11, | ||||
|                 end: 12, | ||||
|                 value: { type: 'u_integer', data: 1 }, | ||||
|                 value: { type: 'i_integer', data: 1 }, | ||||
|                 raw: '1', | ||||
|               }, | ||||
|               operator: '*', | ||||
| @ -1271,7 +1271,7 @@ describe('nests binary expressions correctly', () => { | ||||
|                 type: 'Literal', | ||||
|                 start: 15, | ||||
|                 end: 16, | ||||
|                 value: { type: 'u_integer', data: 2 }, | ||||
|                 value: { type: 'i_integer', data: 2 }, | ||||
|                 raw: '2', | ||||
|               }, | ||||
|             }, | ||||
| @ -1280,7 +1280,7 @@ describe('nests binary expressions correctly', () => { | ||||
|               type: 'Literal', | ||||
|               start: 19, | ||||
|               end: 20, | ||||
|               value: { type: 'u_integer', data: 3 }, | ||||
|               value: { type: 'i_integer', data: 3 }, | ||||
|               raw: '3', | ||||
|             }, | ||||
|           }, | ||||
| @ -1316,7 +1316,7 @@ describe('nests binary expressions correctly', () => { | ||||
|               type: 'Literal', | ||||
|               start: 11, | ||||
|               end: 12, | ||||
|               value: { type: 'u_integer', data: 1 }, | ||||
|               value: { type: 'i_integer', data: 1 }, | ||||
|               raw: '1', | ||||
|             }, | ||||
|             operator: '+', | ||||
| @ -1328,7 +1328,7 @@ describe('nests binary expressions correctly', () => { | ||||
|                 type: 'Literal', | ||||
|                 start: 15, | ||||
|                 end: 16, | ||||
|                 value: { type: 'u_integer', data: 2 }, | ||||
|                 value: { type: 'i_integer', data: 2 }, | ||||
|                 raw: '2', | ||||
|               }, | ||||
|               operator: '*', | ||||
| @ -1336,7 +1336,7 @@ describe('nests binary expressions correctly', () => { | ||||
|                 type: 'Literal', | ||||
|                 start: 19, | ||||
|                 end: 20, | ||||
|                 value: { type: 'u_integer', data: 3 }, | ||||
|                 value: { type: 'i_integer', data: 3 }, | ||||
|                 raw: '3', | ||||
|               }, | ||||
|             }, | ||||
| @ -1360,7 +1360,7 @@ describe('nests binary expressions correctly', () => { | ||||
|           type: 'Literal', | ||||
|           start: 11, | ||||
|           end: 12, | ||||
|           value: { type: 'u_integer', data: 1 }, | ||||
|           value: { type: 'i_integer', data: 1 }, | ||||
|           raw: '1', | ||||
|         }, | ||||
|         operator: '+', | ||||
| @ -1368,7 +1368,7 @@ describe('nests binary expressions correctly', () => { | ||||
|           type: 'Literal', | ||||
|           start: 15, | ||||
|           end: 16, | ||||
|           value: { type: 'u_integer', data: 2 }, | ||||
|           value: { type: 'i_integer', data: 2 }, | ||||
|           raw: '2', | ||||
|         }, | ||||
|       }, | ||||
| @ -1377,7 +1377,7 @@ describe('nests binary expressions correctly', () => { | ||||
|         type: 'Literal', | ||||
|         start: 19, | ||||
|         end: 20, | ||||
|         value: { type: 'u_integer', data: 3 }, | ||||
|         value: { type: 'i_integer', data: 3 }, | ||||
|         raw: '3', | ||||
|       }, | ||||
|     }) | ||||
| @ -1397,7 +1397,7 @@ describe('nests binary expressions correctly', () => { | ||||
|           type: 'Literal', | ||||
|           start: 11, | ||||
|           end: 12, | ||||
|           value: { type: 'u_integer', data: 1 }, | ||||
|           value: { type: 'i_integer', data: 1 }, | ||||
|           raw: '1', | ||||
|         }, | ||||
|         operator: '*', | ||||
| @ -1405,7 +1405,7 @@ describe('nests binary expressions correctly', () => { | ||||
|           type: 'Literal', | ||||
|           start: 15, | ||||
|           end: 16, | ||||
|           value: { type: 'u_integer', data: 2 }, | ||||
|           value: { type: 'i_integer', data: 2 }, | ||||
|           raw: '2', | ||||
|         }, | ||||
|       }, | ||||
| @ -1414,7 +1414,7 @@ describe('nests binary expressions correctly', () => { | ||||
|         type: 'Literal', | ||||
|         start: 19, | ||||
|         end: 20, | ||||
|         value: { type: 'u_integer', data: 3 }, | ||||
|         value: { type: 'i_integer', data: 3 }, | ||||
|         raw: '3', | ||||
|       }, | ||||
|     }) | ||||
| @ -1435,7 +1435,7 @@ describe('nests binary expressions correctly', () => { | ||||
|         end: 30, | ||||
|         left: { | ||||
|           type: 'Literal', | ||||
|           value: { type: 'u_integer', data: 1 }, | ||||
|           value: { type: 'i_integer', data: 1 }, | ||||
|           raw: '1', | ||||
|           start: 11, | ||||
|           end: 12, | ||||
| @ -1452,7 +1452,7 @@ describe('nests binary expressions correctly', () => { | ||||
|             end: 25, | ||||
|             left: { | ||||
|               type: 'Literal', | ||||
|               value: { type: 'u_integer', data: 2 }, | ||||
|               value: { type: 'i_integer', data: 2 }, | ||||
|               raw: '2', | ||||
|               start: 15, | ||||
|               end: 16, | ||||
| @ -1464,14 +1464,14 @@ describe('nests binary expressions correctly', () => { | ||||
|               end: 25, | ||||
|               left: { | ||||
|                 type: 'Literal', | ||||
|                 value: { type: 'u_integer', data: 3 }, | ||||
|                 value: { type: 'i_integer', data: 3 }, | ||||
|                 raw: '3', | ||||
|                 start: 20, | ||||
|                 end: 21, | ||||
|               }, | ||||
|               right: { | ||||
|                 type: 'Literal', | ||||
|                 value: { type: 'u_integer', data: 4 }, | ||||
|                 value: { type: 'i_integer', data: 4 }, | ||||
|                 raw: '4', | ||||
|                 start: 24, | ||||
|                 end: 25, | ||||
| @ -1480,7 +1480,7 @@ describe('nests binary expressions correctly', () => { | ||||
|           }, | ||||
|           right: { | ||||
|             type: 'Literal', | ||||
|             value: { type: 'u_integer', data: 5 }, | ||||
|             value: { type: 'i_integer', data: 5 }, | ||||
|             raw: '5', | ||||
|             start: 29, | ||||
|             end: 30, | ||||
| @ -1489,7 +1489,7 @@ describe('nests binary expressions correctly', () => { | ||||
|       }, | ||||
|       right: { | ||||
|         type: 'Literal', | ||||
|         value: { type: 'u_integer', data: 6 }, | ||||
|         value: { type: 'i_integer', data: 6 }, | ||||
|         raw: '6', | ||||
|         start: 33, | ||||
|         end: 34, | ||||
| @ -1601,7 +1601,7 @@ describe('test UnaryExpression', () => { | ||||
|             type: 'Literal', | ||||
|             start: 19, | ||||
|             end: 20, | ||||
|             value: { type: 'u_integer', data: 4 }, | ||||
|             value: { type: 'i_integer', data: 4 }, | ||||
|             raw: '4', | ||||
|           }, | ||||
|           { | ||||
| @ -1644,7 +1644,7 @@ describe('testing nested call expressions', () => { | ||||
|           end: 39, | ||||
|           left: { | ||||
|             type: 'Literal', | ||||
|             value: { type: 'u_integer', data: 1 }, | ||||
|             value: { type: 'i_integer', data: 1 }, | ||||
|             raw: '1', | ||||
|             start: 23, | ||||
|             end: 24, | ||||
| @ -1659,14 +1659,14 @@ describe('testing nested call expressions', () => { | ||||
|                 type: 'Literal', | ||||
|                 start: 34, | ||||
|                 end: 35, | ||||
|                 value: { type: 'u_integer', data: 5 }, | ||||
|                 value: { type: 'i_integer', data: 5 }, | ||||
|                 raw: '5', | ||||
|               }, | ||||
|               { | ||||
|                 type: 'Literal', | ||||
|                 start: 37, | ||||
|                 end: 38, | ||||
|                 value: { type: 'u_integer', data: 3 }, | ||||
|                 value: { type: 'i_integer', data: 3 }, | ||||
|                 raw: '3', | ||||
|               }, | ||||
|             ], | ||||
| @ -1712,7 +1712,7 @@ describe('should recognise callExpresions in binaryExpressions', () => { | ||||
|         }, | ||||
|         right: { | ||||
|           type: 'Literal', | ||||
|           value: { type: 'u_integer', data: 1 }, | ||||
|           value: { type: 'i_integer', data: 1 }, | ||||
|           raw: '1', | ||||
|           start: 30, | ||||
|           end: 31, | ||||
|  | ||||
| @ -7,6 +7,7 @@ use parse_display::{Display, FromStr}; | ||||
| use schemars::JsonSchema; | ||||
| use serde::{Deserialize, Serialize}; | ||||
| use serde_json::Map; | ||||
| use serde_json::Number as JNumber; | ||||
| use serde_json::Value as JValue; | ||||
| use tower_lsp::lsp_types::{CompletionItem, CompletionItemKind, DocumentSymbol, Range as LspRange, SymbolKind}; | ||||
|  | ||||
| @ -1342,11 +1343,8 @@ impl Literal { | ||||
|  | ||||
|     fn recast(&self) -> String { | ||||
|         match self.value { | ||||
|             // Use the debug representation, not .to_string(), because | ||||
|             // calling (6.0).to_string() outputs "6" not "6.0". | ||||
|             // It's important that fractional numbers stay fractional after recasting. | ||||
|             LiteralValue::Fractional(n) => format!("{n:?}"), | ||||
|             LiteralValue::IInteger(n) => n.to_string(), | ||||
|             LiteralValue::Fractional(n) => JNumber::from_f64(n).unwrap().to_string(), | ||||
|             LiteralValue::IInteger(n) => JNumber::from(n).to_string(), | ||||
|             LiteralValue::String(ref s) => { | ||||
|                 let quote = if self.raw.trim().starts_with('"') { '"' } else { '\'' }; | ||||
|                 format!("{quote}{s}{quote}") | ||||
|  | ||||
		Reference in New Issue
	
	Block a user