Import Tint changes from Dawn

Changes:
  - 7579c22268f85d7276b4a7339a5a8f0e9ba9c44c [tint][wgsl] Be explicit about overload param/arg count m... by Ben Clayton <bclayton@google.com>
  - b9b4d45bb8b5abe2683ef0199185dc5edbfdae92 [tint] Replace 'break-if' with 'break if' in diagnostic. by Ben Clayton <bclayton@google.com>
  - e660d1cabe7b4eb42645069ef73de72bd521ec39 [tint] More use of styled text by Ben Clayton <bclayton@google.com>
GitOrigin-RevId: 7579c22268f85d7276b4a7339a5a8f0e9ba9c44c
Change-Id: I90876f05e77929ca021c0992a3603f611c98105e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/178220
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/lang/core/constant/eval_binary_op_test.cc b/src/tint/lang/core/constant/eval_binary_op_test.cc
index fd4d890..df37060 100644
--- a/src/tint/lang/core/constant/eval_binary_op_test.cc
+++ b/src/tint/lang/core/constant/eval_binary_op_test.cc
@@ -1989,18 +1989,22 @@
  • 'vec2<T  ✓ >(x: T  ✓ , y: T  ✗ ) -> vec2<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2<T  ✓ >(T  ✓ ) -> vec2<T>' where:
+      ✗  overload expects 1 argument, call passed 2 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2<T  ✓ >(vec2<T>  ✗ ) -> vec2<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2<T  ✓ >() -> vec2<T>' where:
+      ✗  overload expects 0 arguments, call passed 2 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2(x: T  ✓ , y: T  ✗ ) -> vec2<T>' where:
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2(T  ✓ ) -> vec2<T>' where:
-      ✗  overload expects 0 template arguments
+      ✗  overload expects 1 argument, call passed 2 arguments
+      ✗  overload expects 0 template arguments, call passed 1 argument
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2() -> vec2<abstract-int>' where:
-      ✗  overload expects 0 template arguments
+      ✗  overload expects 0 arguments, call passed 2 arguments
+      ✗  overload expects 0 template arguments, call passed 1 argument
  • 'vec2(vec2<T>  ✗ ) -> vec2<T>' where:
       ✗  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
 
@@ -2040,18 +2044,22 @@
  • 'vec2<T  ✓ >(x: T  ✓ , y: T  ✗ ) -> vec2<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2<T  ✓ >(T  ✓ ) -> vec2<T>' where:
+      ✗  overload expects 1 argument, call passed 2 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2<T  ✓ >(vec2<T>  ✗ ) -> vec2<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2<T  ✓ >() -> vec2<T>' where:
+      ✗  overload expects 0 arguments, call passed 2 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2(x: T  ✓ , y: T  ✗ ) -> vec2<T>' where:
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2(T  ✓ ) -> vec2<T>' where:
-      ✗  overload expects 0 template arguments
+      ✗  overload expects 1 argument, call passed 2 arguments
+      ✗  overload expects 0 template arguments, call passed 1 argument
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec2() -> vec2<abstract-int>' where:
-      ✗  overload expects 0 template arguments
+      ✗  overload expects 0 arguments, call passed 2 arguments
+      ✗  overload expects 0 template arguments, call passed 1 argument
  • 'vec2(vec2<T>  ✗ ) -> vec2<T>' where:
       ✗  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
 
diff --git a/src/tint/lang/core/intrinsic/table.cc b/src/tint/lang/core/intrinsic/table.cc
index 8c986d2..7b71604 100644
--- a/src/tint/lang/core/intrinsic/table.cc
+++ b/src/tint/lang/core/intrinsic/table.cc
@@ -607,11 +607,20 @@
         first = false;
     };
 
+    if (all_params_match && args.Length() > overload.num_parameters) {
+        separator();
+        ss << style::Mismatch(" ✗ ")
+           << style::Plain(" overload expects ", static_cast<int>(overload.num_parameters),
+                           " argument", overload.num_parameters != 1 ? "s" : "", ", call passed ",
+                           args.Length(), " argument", args.Length() != 1 ? "s" : "");
+    }
     if (all_params_match && template_args.Length() > overload.num_explicit_templates) {
         separator();
         ss << style::Mismatch(" ✗ ")
            << style::Plain(" overload expects ", static_cast<int>(overload.num_explicit_templates),
-                           " template argument", overload.num_explicit_templates != 1 ? "s" : "");
+                           " template argument", overload.num_explicit_templates != 1 ? "s" : "",
+                           ", call passed ", template_args.Length(), " argument",
+                           template_args.Length() != 1 ? "s" : "");
     }
 
     for (size_t i = 0; i < overload.num_templates; i++) {
diff --git a/src/tint/lang/core/intrinsic/table_test.cc b/src/tint/lang/core/intrinsic/table_test.cc
index 31fbc13..ad1bb89 100644
--- a/src/tint/lang/core/intrinsic/table_test.cc
+++ b/src/tint/lang/core/intrinsic/table_test.cc
@@ -593,7 +593,8 @@
 27 candidate functions:
  • 'textureDimensions(texture: texture_depth_2d  ✓ , level: L  ✗ ) -> vec2<u32>' where:
       ✗  'L' is 'i32' or 'u32'
- • 'textureDimensions(texture: texture_depth_2d  ✓ ) -> vec2<u32>'
+ • 'textureDimensions(texture: texture_depth_2d  ✓ ) -> vec2<u32>' where:
+      ✗  overload expects 1 argument, call passed 2 arguments
  • 'textureDimensions(texture: texture_depth_2d_array  ✗ , level: L  ✗ ) -> vec2<u32>' where:
       ✗  'L' is 'i32' or 'u32'
  • 'textureDimensions(texture: texture_depth_cube  ✗ , level: L  ✗ ) -> vec2<u32>' where:
@@ -792,12 +793,14 @@
  • 'vec3<T  ✓ >(x: T  ✓ , yz: vec2<T>  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >(T  ✓ ) -> vec3<T>' where:
+      ✗  overload expects 1 argument, call passed 3 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >(xy: vec2<T>  ✗ , z: T  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >(vec3<T>  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >() -> vec3<T>' where:
+      ✗  overload expects 0 arguments, call passed 3 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
 
 5 candidate conversions:
@@ -881,6 +884,7 @@
  • 'vec3<T  ✓ >(T  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >() -> vec3<T>' where:
+      ✗  overload expects 0 arguments, call passed 1 argument
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >(xy: vec2<T>  ✗ , z: T  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
diff --git a/src/tint/lang/wgsl/intrinsic/table_test.cc b/src/tint/lang/wgsl/intrinsic/table_test.cc
index 4912c68..0393998 100644
--- a/src/tint/lang/wgsl/intrinsic/table_test.cc
+++ b/src/tint/lang/wgsl/intrinsic/table_test.cc
@@ -613,7 +613,8 @@
 27 candidate functions:
  • 'textureDimensions(texture: texture_depth_2d  ✓ , level: L  ✗ ) -> vec2<u32>' where:
       ✗  'L' is 'i32' or 'u32'
- • 'textureDimensions(texture: texture_depth_2d  ✓ ) -> vec2<u32>'
+ • 'textureDimensions(texture: texture_depth_2d  ✓ ) -> vec2<u32>' where:
+      ✗  overload expects 1 argument, call passed 2 arguments
  • 'textureDimensions(texture: texture_depth_2d_array  ✗ , level: L  ✗ ) -> vec2<u32>' where:
       ✗  'L' is 'i32' or 'u32'
  • 'textureDimensions(texture: texture_depth_cube  ✗ , level: L  ✗ ) -> vec2<u32>' where:
@@ -834,8 +835,10 @@
  • 'vec3(x: T  ✓ , yz: vec2<T>  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3(T  ✓ ) -> vec3<T>' where:
+      ✗  overload expects 1 argument, call passed 3 arguments
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
- • 'vec3() -> vec3<abstract-int>'
+ • 'vec3() -> vec3<abstract-int>' where:
+      ✗  overload expects 0 arguments, call passed 3 arguments
  • 'vec3(vec3<T>  ✗ ) -> vec3<T>' where:
       ✗  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✗ >(x: T  ✓ , y: T  ✗ , z: T  ✓ ) -> vec3<T>' where:
@@ -845,10 +848,12 @@
  • 'vec3<T  ✗ >(x: T  ✓ , yz: vec2<T>  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✗ >(T  ✓ ) -> vec3<T>' where:
+      ✗  overload expects 1 argument, call passed 3 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✗ >(vec3<T>  ✗ ) -> vec3<T>' where:
       ✗  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✗ >() -> vec3<T>' where:
+      ✗  overload expects 0 arguments, call passed 3 arguments
       ✗  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
 
 5 candidate conversions:
@@ -885,12 +890,14 @@
  • 'vec3<T  ✓ >(x: T  ✓ , yz: vec2<T>  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >(T  ✓ ) -> vec3<T>' where:
+      ✗  overload expects 1 argument, call passed 3 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >(xy: vec2<T>  ✗ , z: T  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >(vec3<T>  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >() -> vec3<T>' where:
+      ✗  overload expects 0 arguments, call passed 3 arguments
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3(x: T  ✓ , y: T  ✗ , z: T  ✓ ) -> vec3<T>' where:
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
@@ -899,10 +906,12 @@
  • 'vec3(x: T  ✓ , yz: vec2<T>  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3(T  ✓ ) -> vec3<T>' where:
-      ✗  overload expects 0 template arguments
+      ✗  overload expects 1 argument, call passed 3 arguments
+      ✗  overload expects 0 template arguments, call passed 1 argument
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3() -> vec3<abstract-int>' where:
-      ✗  overload expects 0 template arguments
+      ✗  overload expects 0 arguments, call passed 3 arguments
+      ✗  overload expects 0 template arguments, call passed 1 argument
  • 'vec3(vec3<T>  ✗ ) -> vec3<T>' where:
       ✗  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
 
@@ -1017,6 +1026,7 @@
  • 'vec3<T  ✓ >(T  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >() -> vec3<T>' where:
+      ✗  overload expects 0 arguments, call passed 1 argument
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3<T  ✓ >(xy: vec2<T>  ✗ , z: T  ✗ ) -> vec3<T>' where:
       ✓  'T' is 'f32', 'f16', 'i32', 'u32' or 'bool'
@@ -1027,7 +1037,8 @@
  • 'vec3(T  ✗ ) -> vec3<T>' where:
       ✗  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3() -> vec3<abstract-int>' where:
-      ✗  overload expects 0 template arguments
+      ✗  overload expects 0 arguments, call passed 1 argument
+      ✗  overload expects 0 template arguments, call passed 1 argument
  • 'vec3(vec3<T>  ✗ ) -> vec3<T>' where:
       ✗  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'i32', 'u32' or 'bool'
  • 'vec3(x: T  ✗ , yz: vec2<T>  ✗ ) -> vec3<T>' where:
diff --git a/src/tint/lang/wgsl/resolver/atomics_validation_test.cc b/src/tint/lang/wgsl/resolver/atomics_validation_test.cc
index bd8cf06..e00952c 100644
--- a/src/tint/lang/wgsl/resolver/atomics_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/atomics_validation_test.cc
@@ -66,7 +66,7 @@
     GlobalVar("a", ty.atomic(ty.f32(Source{{12, 34}})), core::AddressSpace::kWorkgroup);
 
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(), "12:34 error: atomic only supports i32 or u32 types");
+    EXPECT_EQ(r()->error(), "12:34 error: 'atomic' only supports 'i32' or 'u32' types");
 }
 
 TEST_F(ResolverAtomicValidationTest, InvalidAddressSpace_Simple) {
diff --git a/src/tint/lang/wgsl/resolver/builtin_test.cc b/src/tint/lang/wgsl/resolver/builtin_test.cc
index b29c901..e9a2788 100644
--- a/src/tint/lang/wgsl/resolver/builtin_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtin_test.cc
@@ -879,6 +879,7 @@
 
 1 candidate function:
  • 'cross(vec3<T>  ✓ , vec3<T>  ✓ ) -> vec3<T>' where:
+      ✗  overload expects 2 arguments, call passed 3 arguments
       ✓  'T' is 'abstract-float', 'f32' or 'f16'
 )");
 }
@@ -940,6 +941,7 @@
 
 2 candidate functions:
  • 'distance(vecN<T>  ✓ , vecN<T>  ✓ ) -> T' where:
+      ✗  overload expects 2 arguments, call passed 3 arguments
       ✓  'T' is 'abstract-float', 'f32' or 'f16'
  • 'distance(T  ✗ , T  ✗ ) -> T' where:
       ✗  'T' is 'abstract-float', 'f32' or 'f16'
@@ -1197,6 +1199,7 @@
 
 2 candidate functions:
  • 'length(T  ✓ ) -> T' where:
+      ✗  overload expects 1 argument, call passed 2 arguments
       ✓  'T' is 'abstract-float', 'f32' or 'f16'
  • 'length(vecN<T>  ✗ ) -> T' where:
       ✗  'T' is 'abstract-float', 'f32' or 'f16'
@@ -1393,6 +1396,7 @@
 
 2 candidate functions:
  • 'modf(T  ✓ ) -> __modf_result_T' where:
+      ✗  overload expects 1 argument, call passed 2 arguments
       ✓  'T' is 'abstract-float', 'f32' or 'f16'
  • 'modf(vecN<T>  ✗ ) -> __modf_result_vecN_T' where:
       ✗  'T' is 'abstract-float', 'f32' or 'f16'
@@ -1409,6 +1413,7 @@
 
 2 candidate functions:
  • 'modf(T  ✓ ) -> __modf_result_T' where:
+      ✗  overload expects 1 argument, call passed 2 arguments
       ✓  'T' is 'abstract-float', 'f32' or 'f16'
  • 'modf(vecN<T>  ✗ ) -> __modf_result_vecN_T' where:
       ✗  'T' is 'abstract-float', 'f32' or 'f16'
@@ -1427,6 +1432,7 @@
 
 2 candidate functions:
  • 'modf(vecN<T>  ✓ ) -> __modf_result_vecN_T' where:
+      ✗  overload expects 1 argument, call passed 2 arguments
       ✓  'T' is 'abstract-float', 'f32' or 'f16'
  • 'modf(T  ✗ ) -> __modf_result_T' where:
       ✗  'T' is 'abstract-float', 'f32' or 'f16'
diff --git a/src/tint/lang/wgsl/resolver/builtin_validation_test.cc b/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
index 6b55f36..728a7b8 100644
--- a/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
@@ -168,10 +168,12 @@
 
 2 candidate constructors:
  • 'i32(i32  ✗ ) -> i32'
- • 'i32() -> i32'
+ • 'i32() -> i32' where:
+      ✗  overload expects 0 arguments, call passed 3 arguments
 
 1 candidate conversion:
  • 'i32(T  ✓ ) -> i32' where:
+      ✗  overload expects 1 argument, call passed 3 arguments
       ✓  'T' is 'abstract-int', 'abstract-float', 'f32', 'f16', 'u32' or 'bool'
 )");
 }
diff --git a/src/tint/lang/wgsl/resolver/call_validation_test.cc b/src/tint/lang/wgsl/resolver/call_validation_test.cc
index b10f3fc..d7b4c57 100644
--- a/src/tint/lang/wgsl/resolver/call_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/call_validation_test.cc
@@ -523,7 +523,7 @@
 
 2 candidate functions:
  • 'min(T  ✓ , T  ✓ ) -> T' where:
-      ✗  overload expects 0 template arguments
+      ✗  overload expects 0 template arguments, call passed 1 argument
       ✓  'T' is 'abstract-float', 'abstract-int', 'f32', 'i32', 'u32' or 'f16'
  • 'min(vecN<T>  ✗ , vecN<T>  ✗ ) -> vecN<T>' where:
       ✗  'T' is 'abstract-float', 'abstract-int', 'f32', 'i32', 'u32' or 'f16'
diff --git a/src/tint/lang/wgsl/resolver/sem_helper.cc b/src/tint/lang/wgsl/resolver/sem_helper.cc
index 494e4f8..fbd74a9 100644
--- a/src/tint/lang/wgsl/resolver/sem_helper.cc
+++ b/src/tint/lang/wgsl/resolver/sem_helper.cc
@@ -155,7 +155,9 @@
                 }
             }
             auto& note = AddNote(ident->source);
-            tint::SuggestAlternatives(name, filtered.Slice(), note.message);
+            SuggestAlternativeOptions opts;
+            opts.alternatives_style = style::Enum;
+            SuggestAlternatives(name, filtered.Slice(), note.message, opts);
         }
         return;
     }
diff --git a/src/tint/lang/wgsl/resolver/validation_test.cc b/src/tint/lang/wgsl/resolver/validation_test.cc
index db92d22..2e88cc0 100644
--- a/src/tint/lang/wgsl/resolver/validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/validation_test.cc
@@ -1017,9 +1017,9 @@
                                                   // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInIfElseInContinuing) {
@@ -1031,9 +1031,9 @@
                                              // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInContinuing) {
@@ -1042,9 +1042,9 @@
                                           // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInIfInIfInContinuing) {
@@ -1057,9 +1057,9 @@
                                                              // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInIfTrueMultipleStmtsInContinuing) {
@@ -1071,9 +1071,9 @@
                                                     // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInIfElseMultipleStmtsInContinuing) {
@@ -1086,9 +1086,9 @@
                                                     // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInIfElseIfInContinuing) {
@@ -1100,9 +1100,9 @@
                                                         // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInIfNonEmptyElseInContinuing) {
@@ -1115,9 +1115,9 @@
                                                  // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInIfElseNonEmptyTrueInContinuing) {
@@ -1130,9 +1130,9 @@
                                                            // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakInIfInContinuingNotLast) {
@@ -1144,9 +1144,9 @@
                                              // }
     WrapInFunction(Loop(Block(), cont));
     EXPECT_FALSE(r()->Resolve());
-    EXPECT_EQ(r()->error(),
-              "12:34 error: `break` must not be used to exit from a continuing block. "
-              "Use `break-if` instead.");
+    EXPECT_EQ(
+        r()->error(),
+        R"(12:34 error: 'break' must not be used to exit from a continuing block. Use 'break if' instead.)");
 }
 
 TEST_F(ResolverValidationTest, Stmt_BreakNotInLoopOrSwitch) {
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc
index c6412ff..adc0134 100644
--- a/src/tint/lang/wgsl/resolver/validator.cc
+++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -325,7 +325,9 @@
     // https://gpuweb.github.io/gpuweb/wgsl/#atomic-types
     // T must be either u32 or i32.
     if (!s->Type()->IsAnyOf<core::type::U32, core::type::I32>()) {
-        AddError(a->arguments[0]->source) << "atomic only supports i32 or u32 types";
+        AddError(a->arguments[0]->source)
+            << style::Type("atomic") << " only supports " << style::Type("i32") << " or "
+            << style::Type("u32") << " types";
         return false;
     }
     return true;
@@ -1573,8 +1575,8 @@
     if (ClosestContinuing(/*stop_at_loop*/ true, /* stop_at_switch */ true, current_statement) !=
         nullptr) {
         AddError(stmt->Declaration()->source)
-            << "`break` must not be used to exit from a continuing block. Use "
-               "`break-if` instead.";
+            << style::Keyword("break") << " must not be used to exit from a continuing block. Use "
+            << style::Keyword("break if") << " instead.";
         return false;
     }
     return true;
diff --git a/src/tint/utils/text/string.cc b/src/tint/utils/text/string.cc
index 374176e..47d7a90c 100644
--- a/src/tint/utils/text/string.cc
+++ b/src/tint/utils/text/string.cc
@@ -69,6 +69,7 @@
                          const SuggestAlternativeOptions& options /* = {} */) {
     // If the string typed was within kSuggestionDistance of one of the possible enum values,
     // suggest that. Don't bother with suggestions if the string was extremely long.
+    auto default_style = ss.Style();
     constexpr size_t kSuggestionDistance = 5;
     constexpr size_t kSuggestionMaxLength = 64;
     if (!got.empty() && got.size() < kSuggestionMaxLength) {
@@ -82,7 +83,8 @@
             }
         }
         if (!candidate.empty()) {
-            ss << "Did you mean '" << options.prefix << candidate << "'?";
+            ss << "Did you mean " << options.alternatives_style << options.prefix << candidate
+               << default_style << "?";
             if (options.list_possible_values) {
                 ss << "\n";
             }
@@ -96,7 +98,7 @@
             if (str != strings[0]) {
                 ss << ", ";
             }
-            ss << "'" << options.prefix << str << "'";
+            ss << options.alternatives_style << options.prefix << str << default_style;
         }
     }
 }
diff --git a/src/tint/utils/text/string.h b/src/tint/utils/text/string.h
index 6ccd38d..e000c79 100644
--- a/src/tint/utils/text/string.h
+++ b/src/tint/utils/text/string.h
@@ -34,6 +34,7 @@
 #include "src/tint/utils/containers/slice.h"
 #include "src/tint/utils/containers/vector.h"
 #include "src/tint/utils/text/string_stream.h"
+#include "src/tint/utils/text/text_style.h"
 
 /// Forward declaration
 namespace tint {
@@ -118,6 +119,8 @@
 struct SuggestAlternativeOptions {
     /// The prefix to apply to the strings when printing
     std::string_view prefix;
+    /// The text style for alternatives
+    TextStyle alternatives_style = style::Code;
     /// List all the possible values
     bool list_possible_values = true;
 };