From cd648c7c1d3c7fd1db9cf6378f85f4d9dfff7805 Mon Sep 17 00:00:00 2001 From: Marco Sampellegrini Date: Mon, 11 Sep 2023 15:27:16 +0200 Subject: [PATCH] Unify string types under a single `StrType`. --- compiler/src/ast.rs | 9 +- compiler/src/codegen.rs | 14 +- compiler/src/infer.rs | 10 - compiler/src/parser.rs | 18 +- ...in-a-function-gets-its-own-return-type.exp | 8 +- .../infer-expr/aliasing-in-a-match-arm.exp | 4 +- .../infer-expr/can-shadow-vars-in-block.exp | 8 +- ...um-variants-get-instantiated-correctly.exp | 4 +- .../enums-can-be-returned-from-functions.exp | 4 +- ...ions-get-instantiated-at-each-use-site.exp | 4 +- .../match-and-if-are-still-expressions.exp | 8 +- .../snapshot/infer-expr/match-expressions.exp | 4 +- .../snapshot/infer-expr/match-weirdness.exp | 4 +- .../snapshot/infer-expr/mutable-variables.exp | 273 ++++++++++++++++++ .../nested-pattern-matching-is-supported.exp | 4 +- .../snapshot/infer-expr/nested-updates.exp | 12 +- .../pattern-matching-on-structs.exp | 12 +- .../pattern-matching-works-on-enums.exp | 12 +- .../plus-operator-works-with-strings.exp | 8 +- .../infer-expr/slices-are-polymorphic.exp | 4 +- .../spreading-a-struct-into-another.exp | 8 +- .../struct-inference-in-lambdas.exp | 8 +- .../struct-patterns-on-generic-structs.exp | 8 +- .../snapshot/infer-expr/struct-patterns.exp | 4 +- .../snapshot/infer-expr/tuple-fields-ii.exp | 4 +- .../test/snapshot/infer-expr/tuple-fields.exp | 4 +- .../tuple-patterns-in-let-bindings.exp | 4 +- .../tuple-patterns-in-match-arms.exp | 8 +- .../snapshot/infer-expr/tuple-patterns.exp | 4 +- .../infer-expr/tuples-as-return-type.exp | 4 +- .../snapshot/infer-expr/wildcard-matches.exp | 8 +- .../infer-file/access-maps-by-index.exp | 8 +- .../infer-file/access-slices-by-index.exp | 4 +- .../access-struct-fields-from-package.exp | 4 +- .../check-if-type-implements-trait.exp | 4 +- .../test/snapshot/infer-file/for-loops.exp | 8 +- .../infer-file/generics-in-impl-method.exp | 4 +- .../method-calls-work-for-enums.exp | 8 +- .../test/snapshot/infer-file/parse-traits.exp | 4 +- ...ferences-are-maintained-after-try-call.exp | 4 +- .../test/snapshot/infer-file/trait-bounds.exp | 4 +- .../snapshot/infer-file/tuple-structs.exp | 4 +- .../test/snapshot/infer-file/type-aliases.exp | 4 +- .../infer-file/variadic-functions.exp | 16 +- .../infer-file/well-formed-select.exp | 4 +- .../methods-can-span-multiple-lines.exp | 4 +- .../test/snapshot/parse-expr/multistrings.exp | 12 +- .../snapshot/parse-expr/spawn-statements.exp | 4 +- .../snapshot/parse-expr/strings-and-chars.exp | 4 +- .../test/snapshot/parse-expr/tuple-type.exp | 4 +- 50 files changed, 498 insertions(+), 98 deletions(-) diff --git a/compiler/src/ast.rs b/compiler/src/ast.rs index 04650d0..ff5a88a 100644 --- a/compiler/src/ast.rs +++ b/compiler/src/ast.rs @@ -608,12 +608,17 @@ pub enum Literal { Int(i64), Float(f64), Bool(bool), - String(String), - MultiString(Vec), + String(StrType), Char(String), // Rust char and Go rune are slightly different, just fallback to a String Slice(Vec), } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub enum StrType { + Single(String), // "quoted string" + Multi(Vec), // multi-line string +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum Operator { Add, diff --git a/compiler/src/codegen.rs b/compiler/src/codegen.rs index fcbc213..2711250 100644 --- a/compiler/src/codegen.rs +++ b/compiler/src/codegen.rs @@ -4,7 +4,7 @@ use crate::{ ast::{ Arm, Binding, Constructor, DebugKind, EnumDefinition, EnumFieldDef, Expr, File, FileId, Function, FunctionKind, Generic, InterfaceSuperTrait, Literal, Loop, LoopFlow, Operator, - Pat, SelectArm, SelectArmPat, Span, StructDefinition, StructField, UnOp, + Pat, SelectArm, SelectArmPat, Span, StrType, StructDefinition, StructField, UnOp, }, global_state::Module, infer, @@ -832,11 +832,13 @@ if {new_is_matching} != 1 {{ Literal::Int(n) => n.to_string(), Literal::Float(n) => n.to_string(), Literal::Bool(b) => b.to_string(), - Literal::String(s) => format!("\"{}\"", s).replace('\n', "\\n"), - Literal::MultiString(lines) => { - let body = lines.join("\n"); - format!("`{}`", body) - } + Literal::String(inner) => match inner { + StrType::Single(s) => format!("\"{}\"", s).replace('\n', "\\n"), + StrType::Multi(lines) => { + let body = lines.join("\n"); + format!("`{}`", body) + } + }, Literal::Char(s) => { format!("\'{}\'", s) } diff --git a/compiler/src/infer.rs b/compiler/src/infer.rs index f9968f9..6990dd9 100644 --- a/compiler/src/infer.rs +++ b/compiler/src/infer.rs @@ -277,16 +277,6 @@ impl Infer { } } - Literal::MultiString(s) => { - self.add_constraint(expected, &self.type_string(), &span); - - Expr::Literal { - lit: Literal::MultiString(s), - ty: self.type_string(), - span, - } - } - Literal::Char(s) => { self.add_constraint(expected, &self.type_char(), &span); diff --git a/compiler/src/parser.rs b/compiler/src/parser.rs index 7f27817..c41413f 100644 --- a/compiler/src/parser.rs +++ b/compiler/src/parser.rs @@ -2,7 +2,7 @@ use crate::{ ast::{ Arm, Binding, Constructor, EnumDefinition, EnumFieldDef, Expr, FileId, Function, FunctionKind, Generic, InterfaceSuperTrait, LineColumn, Literal, Loop, LoopFlow, - NewtypeDefinition, Operator, Pat, PkgImport, SelectArm, SelectArmPat, Span, + NewtypeDefinition, Operator, Pat, PkgImport, SelectArm, SelectArmPat, Span, StrType, StructDefinition, StructField, StructFieldDef, StructFieldPat, TypeAliasDef, TypeAst, UnOp, }, lexer::{Lexer, Pos, Token, TokenKind, TokenKind::EOF}, @@ -300,7 +300,7 @@ impl Parser { TokenKind::Bool => Literal::Bool(self.tok.text == "true"), - TokenKind::String => Literal::String(self.tok.text.clone()), + TokenKind::String => Literal::String(StrType::Single(self.tok.text.clone())), TokenKind::Char => Literal::Char(self.tok.text.clone()), @@ -642,7 +642,7 @@ impl Parser { */ } - let lit = Literal::MultiString(lines); + let lit = Literal::String(StrType::Multi(lines)); Expr::Literal { lit, @@ -965,14 +965,12 @@ impl Parser { let args = self.parse_paren(ParseParen::Paren); let text = match args.first() { Some(Expr::Literal { - lit: Literal::String(s), + lit: Literal::String(inner), .. - }) => s.to_string(), - - Some(Expr::Literal { - lit: Literal::MultiString(lines), - .. - }) => lines.join("\n"), + }) => match inner { + StrType::Single(s) => s.to_string(), + StrType::Multi(lines) => lines.join("\n"), + }, _ => { self.error("invalid call to rawgo!".to_string()); diff --git a/compiler/test/snapshot/infer-expr/a-function-within-a-function-gets-its-own-return-type.exp b/compiler/test/snapshot/infer-expr/a-function-within-a-function-gets-its-own-return-type.exp index e63c6a3..2ecebfa 100644 --- a/compiler/test/snapshot/infer-expr/a-function-within-a-function-gets-its-own-return-type.exp +++ b/compiler/test/snapshot/infer-expr/a-function-within-a-function-gets-its-own-return-type.exp @@ -103,7 +103,9 @@ No errors. "expr": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { @@ -186,7 +188,9 @@ No errors. { "Literal": { "lit": { - "String": "bar" + "String": { + "Single": "bar" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/aliasing-in-a-match-arm.exp b/compiler/test/snapshot/infer-expr/aliasing-in-a-match-arm.exp index 294f8b2..60fa9ad 100644 --- a/compiler/test/snapshot/infer-expr/aliasing-in-a-match-arm.exp +++ b/compiler/test/snapshot/infer-expr/aliasing-in-a-match-arm.exp @@ -66,7 +66,9 @@ No errors. "expr": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/can-shadow-vars-in-block.exp b/compiler/test/snapshot/infer-expr/can-shadow-vars-in-block.exp index 0e2ec04..43f8b80 100644 --- a/compiler/test/snapshot/infer-expr/can-shadow-vars-in-block.exp +++ b/compiler/test/snapshot/infer-expr/can-shadow-vars-in-block.exp @@ -49,7 +49,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "mutable" + "String": { + "Single": "mutable" + } }, "ty": { "Con": { @@ -125,7 +127,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "block" + "String": { + "Single": "block" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/enum-variants-get-instantiated-correctly.exp b/compiler/test/snapshot/infer-expr/enum-variants-get-instantiated-correctly.exp index 283b2af..1e0c47f 100644 --- a/compiler/test/snapshot/infer-expr/enum-variants-get-instantiated-correctly.exp +++ b/compiler/test/snapshot/infer-expr/enum-variants-get-instantiated-correctly.exp @@ -306,7 +306,9 @@ No errors. { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/enums-can-be-returned-from-functions.exp b/compiler/test/snapshot/infer-expr/enums-can-be-returned-from-functions.exp index e55278f..ae2fe25 100644 --- a/compiler/test/snapshot/infer-expr/enums-can-be-returned-from-functions.exp +++ b/compiler/test/snapshot/infer-expr/enums-can-be-returned-from-functions.exp @@ -610,7 +610,9 @@ No errors. { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/generic-functions-get-instantiated-at-each-use-site.exp b/compiler/test/snapshot/infer-expr/generic-functions-get-instantiated-at-each-use-site.exp index 5b77767..f34380b 100644 --- a/compiler/test/snapshot/infer-expr/generic-functions-get-instantiated-at-each-use-site.exp +++ b/compiler/test/snapshot/infer-expr/generic-functions-get-instantiated-at-each-use-site.exp @@ -353,7 +353,9 @@ No errors. { "Literal": { "lit": { - "String": "hello" + "String": { + "Single": "hello" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/match-and-if-are-still-expressions.exp b/compiler/test/snapshot/infer-expr/match-and-if-are-still-expressions.exp index 505a946..b8a3d0b 100644 --- a/compiler/test/snapshot/infer-expr/match-and-if-are-still-expressions.exp +++ b/compiler/test/snapshot/infer-expr/match-and-if-are-still-expressions.exp @@ -60,7 +60,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { @@ -171,7 +173,9 @@ No errors. "pat": { "Lit": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/match-expressions.exp b/compiler/test/snapshot/infer-expr/match-expressions.exp index 4a9c35c..d1d8c05 100644 --- a/compiler/test/snapshot/infer-expr/match-expressions.exp +++ b/compiler/test/snapshot/infer-expr/match-expressions.exp @@ -65,7 +65,9 @@ No errors. "expr": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/match-weirdness.exp b/compiler/test/snapshot/infer-expr/match-weirdness.exp index de6cbe4..8f4963f 100644 --- a/compiler/test/snapshot/infer-expr/match-weirdness.exp +++ b/compiler/test/snapshot/infer-expr/match-weirdness.exp @@ -124,7 +124,9 @@ No errors. { "Literal": { "lit": { - "String": "asdf" + "String": { + "Single": "asdf" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/mutable-variables.exp b/compiler/test/snapshot/infer-expr/mutable-variables.exp index e69de29..fda09f0 100644 --- a/compiler/test/snapshot/infer-expr/mutable-variables.exp +++ b/compiler/test/snapshot/infer-expr/mutable-variables.exp @@ -0,0 +1,273 @@ +Mutable variables + +SOURCE: +{ + let mut x = 0 + x = x + 1 + x +} + +OUTPUT: +int +--- +No errors. +--- +{ + "Block": { + "stmts": [ + { + "Let": { + "binding": { + "pat": { + "Type": { + "ident": "x", + "is_mut": false, + "ann": "Unknown", + "span": { + "start": { + "line": 2, + "col": 11 + }, + "end": { + "line": 2, + "col": 12 + }, + "file": 99 + } + } + }, + "ann": "Unknown", + "ty": { + "Con": { + "id": "int", + "args": [] + } + } + }, + "value": { + "Literal": { + "lit": { + "Int": 0 + }, + "ty": { + "Con": { + "id": "int", + "args": [] + } + }, + "span": { + "start": { + "line": 2, + "col": 15 + }, + "end": { + "line": 2, + "col": 16 + }, + "file": 99 + } + } + }, + "mutable": true, + "ty": { + "Con": { + "id": "int", + "args": [] + } + }, + "span": { + "start": { + "line": 2, + "col": 3 + }, + "end": { + "line": 2, + "col": 16 + }, + "file": 99 + } + } + }, + { + "VarUpdate": { + "target": { + "Var": { + "value": "x", + "decl": { + "start": { + "line": 2, + "col": 11 + }, + "end": { + "line": 2, + "col": 12 + }, + "file": 99 + }, + "generics_instantiated": [], + "ty": { + "Con": { + "id": "int", + "args": [] + } + }, + "span": { + "start": { + "line": 3, + "col": 3 + }, + "end": { + "line": 3, + "col": 4 + }, + "file": 99 + } + } + }, + "value": { + "Binary": { + "op": "Add", + "left": { + "Var": { + "value": "x", + "decl": { + "start": { + "line": 2, + "col": 11 + }, + "end": { + "line": 2, + "col": 12 + }, + "file": 99 + }, + "generics_instantiated": [], + "ty": { + "Con": { + "id": "int", + "args": [] + } + }, + "span": { + "start": { + "line": 3, + "col": 7 + }, + "end": { + "line": 3, + "col": 8 + }, + "file": 99 + } + } + }, + "right": { + "Literal": { + "lit": { + "Int": 1 + }, + "ty": { + "Con": { + "id": "int", + "args": [] + } + }, + "span": { + "start": { + "line": 3, + "col": 11 + }, + "end": { + "line": 3, + "col": 12 + }, + "file": 99 + } + } + }, + "ty": { + "Con": { + "id": "int", + "args": [] + } + }, + "span": { + "start": { + "line": 3, + "col": 7 + }, + "end": { + "line": 3, + "col": 12 + }, + "file": 99 + } + } + }, + "span": { + "start": { + "line": 3, + "col": 3 + }, + "end": { + "line": 3, + "col": 12 + }, + "file": 99 + } + } + }, + { + "Var": { + "value": "x", + "decl": { + "start": { + "line": 2, + "col": 11 + }, + "end": { + "line": 2, + "col": 12 + }, + "file": 99 + }, + "generics_instantiated": [], + "ty": { + "Con": { + "id": "int", + "args": [] + } + }, + "span": { + "start": { + "line": 4, + "col": 3 + }, + "end": { + "line": 4, + "col": 4 + }, + "file": 99 + } + } + } + ], + "ty": { + "Con": { + "id": "int", + "args": [] + } + }, + "span": { + "start": { + "line": 1, + "col": 1 + }, + "end": { + "line": 5, + "col": 1 + }, + "file": 99 + } + } +} diff --git a/compiler/test/snapshot/infer-expr/nested-pattern-matching-is-supported.exp b/compiler/test/snapshot/infer-expr/nested-pattern-matching-is-supported.exp index 8c46a35..dff4b8d 100644 --- a/compiler/test/snapshot/infer-expr/nested-pattern-matching-is-supported.exp +++ b/compiler/test/snapshot/infer-expr/nested-pattern-matching-is-supported.exp @@ -242,7 +242,9 @@ No errors. { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/nested-updates.exp b/compiler/test/snapshot/infer-expr/nested-updates.exp index 2642c18..dadcea7 100644 --- a/compiler/test/snapshot/infer-expr/nested-updates.exp +++ b/compiler/test/snapshot/infer-expr/nested-updates.exp @@ -215,7 +215,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { @@ -343,7 +345,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "bar" + "String": { + "Single": "bar" + } }, "ty": { "Con": { @@ -479,7 +483,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "baz" + "String": { + "Single": "baz" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/pattern-matching-on-structs.exp b/compiler/test/snapshot/infer-expr/pattern-matching-on-structs.exp index 0aef60a..adb2269 100644 --- a/compiler/test/snapshot/infer-expr/pattern-matching-on-structs.exp +++ b/compiler/test/snapshot/infer-expr/pattern-matching-on-structs.exp @@ -142,7 +142,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "yo" + "String": { + "Single": "yo" + } }, "ty": { "Con": { @@ -273,7 +275,9 @@ No errors. "value": { "Lit": { "lit": { - "String": "bar" + "String": { + "Single": "bar" + } }, "ty": { "Con": { @@ -377,7 +381,9 @@ No errors. "value": { "Lit": { "lit": { - "String": "bar" + "String": { + "Single": "bar" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/pattern-matching-works-on-enums.exp b/compiler/test/snapshot/infer-expr/pattern-matching-works-on-enums.exp index 0a21be4..ce170b7 100644 --- a/compiler/test/snapshot/infer-expr/pattern-matching-works-on-enums.exp +++ b/compiler/test/snapshot/infer-expr/pattern-matching-works-on-enums.exp @@ -146,7 +146,9 @@ No errors. { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { @@ -271,7 +273,9 @@ No errors. "expr": { "Literal": { "lit": { - "String": "bar" + "String": { + "Single": "bar" + } }, "ty": { "Con": { @@ -429,7 +433,9 @@ No errors. { "Literal": { "lit": { - "String": "!" + "String": { + "Single": "!" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/plus-operator-works-with-strings.exp b/compiler/test/snapshot/infer-expr/plus-operator-works-with-strings.exp index cd842c0..c187684 100644 --- a/compiler/test/snapshot/infer-expr/plus-operator-works-with-strings.exp +++ b/compiler/test/snapshot/infer-expr/plus-operator-works-with-strings.exp @@ -14,7 +14,9 @@ No errors. "left": { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { @@ -38,7 +40,9 @@ No errors. "right": { "Literal": { "lit": { - "String": "b" + "String": { + "Single": "b" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/slices-are-polymorphic.exp b/compiler/test/snapshot/infer-expr/slices-are-polymorphic.exp index c2fb1ac..25f4694 100644 --- a/compiler/test/snapshot/infer-expr/slices-are-polymorphic.exp +++ b/compiler/test/snapshot/infer-expr/slices-are-polymorphic.exp @@ -358,7 +358,9 @@ No errors. { "Literal": { "lit": { - "String": "hello" + "String": { + "Single": "hello" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/spreading-a-struct-into-another.exp b/compiler/test/snapshot/infer-expr/spreading-a-struct-into-another.exp index 68b6c94..b63eb1f 100644 --- a/compiler/test/snapshot/infer-expr/spreading-a-struct-into-another.exp +++ b/compiler/test/snapshot/infer-expr/spreading-a-struct-into-another.exp @@ -138,7 +138,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { @@ -210,7 +212,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "bar" + "String": { + "Single": "bar" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/struct-inference-in-lambdas.exp b/compiler/test/snapshot/infer-expr/struct-inference-in-lambdas.exp index 3a1573b..7532814 100644 --- a/compiler/test/snapshot/infer-expr/struct-inference-in-lambdas.exp +++ b/compiler/test/snapshot/infer-expr/struct-inference-in-lambdas.exp @@ -138,7 +138,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { @@ -519,7 +521,9 @@ No errors. { "Literal": { "lit": { - "String": "!" + "String": { + "Single": "!" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/struct-patterns-on-generic-structs.exp b/compiler/test/snapshot/infer-expr/struct-patterns-on-generic-structs.exp index 7c9e9b6..708aa70 100644 --- a/compiler/test/snapshot/infer-expr/struct-patterns-on-generic-structs.exp +++ b/compiler/test/snapshot/infer-expr/struct-patterns-on-generic-structs.exp @@ -182,7 +182,9 @@ No errors. { "Literal": { "lit": { - "String": "yo" + "String": { + "Single": "yo" + } }, "ty": { "Con": { @@ -476,7 +478,9 @@ No errors. { "Literal": { "lit": { - "String": "asdf" + "String": { + "Single": "asdf" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/struct-patterns.exp b/compiler/test/snapshot/infer-expr/struct-patterns.exp index a0f2a3b..3e99098 100644 --- a/compiler/test/snapshot/infer-expr/struct-patterns.exp +++ b/compiler/test/snapshot/infer-expr/struct-patterns.exp @@ -140,7 +140,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/tuple-fields-ii.exp b/compiler/test/snapshot/infer-expr/tuple-fields-ii.exp index 7e031bf..4b6a004 100644 --- a/compiler/test/snapshot/infer-expr/tuple-fields-ii.exp +++ b/compiler/test/snapshot/infer-expr/tuple-fields-ii.exp @@ -180,7 +180,9 @@ No errors. { "Literal": { "lit": { - "String": "yo" + "String": { + "Single": "yo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/tuple-fields.exp b/compiler/test/snapshot/infer-expr/tuple-fields.exp index 29aa6a3..a1e858d 100644 --- a/compiler/test/snapshot/infer-expr/tuple-fields.exp +++ b/compiler/test/snapshot/infer-expr/tuple-fields.exp @@ -92,7 +92,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/tuple-patterns-in-let-bindings.exp b/compiler/test/snapshot/infer-expr/tuple-patterns-in-let-bindings.exp index 9508c6b..a8d5197 100644 --- a/compiler/test/snapshot/infer-expr/tuple-patterns-in-let-bindings.exp +++ b/compiler/test/snapshot/infer-expr/tuple-patterns-in-let-bindings.exp @@ -153,7 +153,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/tuple-patterns-in-match-arms.exp b/compiler/test/snapshot/infer-expr/tuple-patterns-in-match-arms.exp index 4103c66..4850a44 100644 --- a/compiler/test/snapshot/infer-expr/tuple-patterns-in-match-arms.exp +++ b/compiler/test/snapshot/infer-expr/tuple-patterns-in-match-arms.exp @@ -54,7 +54,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "b" + "String": { + "Single": "b" + } }, "ty": { "Con": { @@ -242,7 +244,9 @@ No errors. "expr": { "Literal": { "lit": { - "String": "c" + "String": { + "Single": "c" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/tuple-patterns.exp b/compiler/test/snapshot/infer-expr/tuple-patterns.exp index 51ed39d..7a772aa 100644 --- a/compiler/test/snapshot/infer-expr/tuple-patterns.exp +++ b/compiler/test/snapshot/infer-expr/tuple-patterns.exp @@ -390,7 +390,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/tuples-as-return-type.exp b/compiler/test/snapshot/infer-expr/tuples-as-return-type.exp index e85b02d..8d3cbdf 100644 --- a/compiler/test/snapshot/infer-expr/tuples-as-return-type.exp +++ b/compiler/test/snapshot/infer-expr/tuples-as-return-type.exp @@ -71,7 +71,9 @@ No errors. "value": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-expr/wildcard-matches.exp b/compiler/test/snapshot/infer-expr/wildcard-matches.exp index 47344a2..463ccc2 100644 --- a/compiler/test/snapshot/infer-expr/wildcard-matches.exp +++ b/compiler/test/snapshot/infer-expr/wildcard-matches.exp @@ -66,7 +66,9 @@ No errors. "expr": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { @@ -107,7 +109,9 @@ No errors. "expr": { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/access-maps-by-index.exp b/compiler/test/snapshot/infer-file/access-maps-by-index.exp index 7c5ba9d..3e87c5a 100644 --- a/compiler/test/snapshot/infer-file/access-maps-by-index.exp +++ b/compiler/test/snapshot/infer-file/access-maps-by-index.exp @@ -319,7 +319,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { @@ -436,7 +438,9 @@ No errors. "index": { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/access-slices-by-index.exp b/compiler/test/snapshot/infer-file/access-slices-by-index.exp index cde49dc..d685165 100644 --- a/compiler/test/snapshot/infer-file/access-slices-by-index.exp +++ b/compiler/test/snapshot/infer-file/access-slices-by-index.exp @@ -76,7 +76,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/access-struct-fields-from-package.exp b/compiler/test/snapshot/infer-file/access-struct-fields-from-package.exp index 8f56585..711f78b 100644 --- a/compiler/test/snapshot/infer-file/access-struct-fields-from-package.exp +++ b/compiler/test/snapshot/infer-file/access-struct-fields-from-package.exp @@ -194,7 +194,9 @@ No errors. { "Literal": { "lit": { - "String": "foo" + "String": { + "Single": "foo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/check-if-type-implements-trait.exp b/compiler/test/snapshot/infer-file/check-if-type-implements-trait.exp index c3d205c..8829a75 100644 --- a/compiler/test/snapshot/infer-file/check-if-type-implements-trait.exp +++ b/compiler/test/snapshot/infer-file/check-if-type-implements-trait.exp @@ -558,7 +558,9 @@ No errors. { "Literal": { "lit": { - "String": "yo" + "String": { + "Single": "yo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/for-loops.exp b/compiler/test/snapshot/infer-file/for-loops.exp index 8e3f5d2..51d3418 100644 --- a/compiler/test/snapshot/infer-file/for-loops.exp +++ b/compiler/test/snapshot/infer-file/for-loops.exp @@ -77,7 +77,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { @@ -341,7 +343,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/generics-in-impl-method.exp b/compiler/test/snapshot/infer-file/generics-in-impl-method.exp index 34bed5f..3946447 100644 --- a/compiler/test/snapshot/infer-file/generics-in-impl-method.exp +++ b/compiler/test/snapshot/infer-file/generics-in-impl-method.exp @@ -582,7 +582,9 @@ No errors. "body": { "Literal": { "lit": { - "String": "asdf" + "String": { + "Single": "asdf" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/method-calls-work-for-enums.exp b/compiler/test/snapshot/infer-file/method-calls-work-for-enums.exp index a847bd0..8ba573b 100644 --- a/compiler/test/snapshot/infer-file/method-calls-work-for-enums.exp +++ b/compiler/test/snapshot/infer-file/method-calls-work-for-enums.exp @@ -711,7 +711,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { @@ -959,7 +961,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/parse-traits.exp b/compiler/test/snapshot/infer-file/parse-traits.exp index 7d01663..ed2f90f 100644 --- a/compiler/test/snapshot/infer-file/parse-traits.exp +++ b/compiler/test/snapshot/infer-file/parse-traits.exp @@ -295,7 +295,9 @@ No errors. { "Literal": { "lit": { - "String": "yo" + "String": { + "Single": "yo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/references-are-maintained-after-try-call.exp b/compiler/test/snapshot/infer-file/references-are-maintained-after-try-call.exp index da89d4c..6132281 100644 --- a/compiler/test/snapshot/infer-file/references-are-maintained-after-try-call.exp +++ b/compiler/test/snapshot/infer-file/references-are-maintained-after-try-call.exp @@ -223,7 +223,9 @@ No errors. { "Literal": { "lit": { - "String": "file" + "String": { + "Single": "file" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/trait-bounds.exp b/compiler/test/snapshot/infer-file/trait-bounds.exp index 5349610..a7464a9 100644 --- a/compiler/test/snapshot/infer-file/trait-bounds.exp +++ b/compiler/test/snapshot/infer-file/trait-bounds.exp @@ -581,7 +581,9 @@ No errors. { "Literal": { "lit": { - "String": "yo" + "String": { + "Single": "yo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/tuple-structs.exp b/compiler/test/snapshot/infer-file/tuple-structs.exp index 954a466..b426a20 100644 --- a/compiler/test/snapshot/infer-file/tuple-structs.exp +++ b/compiler/test/snapshot/infer-file/tuple-structs.exp @@ -986,7 +986,9 @@ No errors. { "Literal": { "lit": { - "String": "yo" + "String": { + "Single": "yo" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/type-aliases.exp b/compiler/test/snapshot/infer-file/type-aliases.exp index 3e1ff30..44375ea 100644 --- a/compiler/test/snapshot/infer-file/type-aliases.exp +++ b/compiler/test/snapshot/infer-file/type-aliases.exp @@ -1137,7 +1137,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/variadic-functions.exp b/compiler/test/snapshot/infer-file/variadic-functions.exp index 00716bd..51812af 100644 --- a/compiler/test/snapshot/infer-file/variadic-functions.exp +++ b/compiler/test/snapshot/infer-file/variadic-functions.exp @@ -434,7 +434,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { @@ -565,7 +567,9 @@ No errors. { "Literal": { "lit": { - "String": "a" + "String": { + "Single": "a" + } }, "ty": { "Con": { @@ -589,7 +593,9 @@ No errors. { "Literal": { "lit": { - "String": "b" + "String": { + "Single": "b" + } }, "ty": { "Con": { @@ -613,7 +619,9 @@ No errors. { "Literal": { "lit": { - "String": "c" + "String": { + "Single": "c" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/infer-file/well-formed-select.exp b/compiler/test/snapshot/infer-file/well-formed-select.exp index f651a5f..0c85760 100644 --- a/compiler/test/snapshot/infer-file/well-formed-select.exp +++ b/compiler/test/snapshot/infer-file/well-formed-select.exp @@ -422,7 +422,9 @@ No errors. { "Literal": { "lit": { - "String": "hi" + "String": { + "Single": "hi" + } }, "ty": { "Con": { diff --git a/compiler/test/snapshot/parse-expr/methods-can-span-multiple-lines.exp b/compiler/test/snapshot/parse-expr/methods-can-span-multiple-lines.exp index 455241a..2e68e9e 100644 --- a/compiler/test/snapshot/parse-expr/methods-can-span-multiple-lines.exp +++ b/compiler/test/snapshot/parse-expr/methods-can-span-multiple-lines.exp @@ -52,7 +52,9 @@ No errors. { "Literal": { "lit": { - "String": "hi" + "String": { + "Single": "hi" + } } } } diff --git a/compiler/test/snapshot/parse-expr/multistrings.exp b/compiler/test/snapshot/parse-expr/multistrings.exp index dc92248..deaaa1e 100644 --- a/compiler/test/snapshot/parse-expr/multistrings.exp +++ b/compiler/test/snapshot/parse-expr/multistrings.exp @@ -30,11 +30,13 @@ No errors. { "Literal": { "lit": { - "MultiString": [ - "hello", - " this is a", - "multiline \\\\ string" - ] + "String": { + "Multi": [ + "hello", + " this is a", + "multiline \\\\ string" + ] + } } } }, diff --git a/compiler/test/snapshot/parse-expr/spawn-statements.exp b/compiler/test/snapshot/parse-expr/spawn-statements.exp index e7dbf2c..36c548c 100644 --- a/compiler/test/snapshot/parse-expr/spawn-statements.exp +++ b/compiler/test/snapshot/parse-expr/spawn-statements.exp @@ -47,7 +47,9 @@ No errors. { "Literal": { "lit": { - "String": "hi" + "String": { + "Single": "hi" + } } } } diff --git a/compiler/test/snapshot/parse-expr/strings-and-chars.exp b/compiler/test/snapshot/parse-expr/strings-and-chars.exp index 2e921fa..e62c711 100644 --- a/compiler/test/snapshot/parse-expr/strings-and-chars.exp +++ b/compiler/test/snapshot/parse-expr/strings-and-chars.exp @@ -14,7 +14,9 @@ No errors. { "Literal": { "lit": { - "String": "hello" + "String": { + "Single": "hello" + } } } }, diff --git a/compiler/test/snapshot/parse-expr/tuple-type.exp b/compiler/test/snapshot/parse-expr/tuple-type.exp index ed87a3d..832867f 100644 --- a/compiler/test/snapshot/parse-expr/tuple-type.exp +++ b/compiler/test/snapshot/parse-expr/tuple-type.exp @@ -52,7 +52,9 @@ No errors. { "Literal": { "lit": { - "String": "bar" + "String": { + "Single": "bar" + } } } }