From eb75b05f7aebd53904492362d6fd1d71285dfda1 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 30 Jul 2025 18:54:31 -0400 Subject: [PATCH 01/15] Update update_data.py: make the space in error comments optional --- mypy/test/update_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/test/update_data.py b/mypy/test/update_data.py index 84b6383b3f0c..2e04444d56e0 100644 --- a/mypy/test/update_data.py +++ b/mypy/test/update_data.py @@ -64,7 +64,7 @@ def _iter_fixes( fix_lines = [] for lineno, source_line in enumerate(source_lines, start=1): reports = reports_by_line.get((file_path, lineno)) - comment_match = re.search(r"(?P\s+)(?P# [EWN]: .+)$", source_line) + comment_match = re.search(r"(?P\s+)(?P# ?[EWN]: .+)$", source_line) if comment_match: source_line = source_line[: comment_match.start("indent")] # strip old comment if reports: From 8bb4ff6ea727e9563c2bade00d1b7138d4220a60 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 30 Jul 2025 19:26:57 -0400 Subject: [PATCH 02/15] Update README.md: docu for the spacedness thing --- test-data/unit/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-data/unit/README.md b/test-data/unit/README.md index aaf774d1b62f..1c9aa73dcfb6 100644 --- a/test-data/unit/README.md +++ b/test-data/unit/README.md @@ -31,7 +31,7 @@ with text "abc..." - note a space after `E:` and `flags:` - `# E:12` adds column number to the expected error - use `\` to escape the `#` character and indicate that the rest of the line is part of -the error message +the error message (note that there is no support for using \\ to escape a backslash) - repeating `# E: ` several times in one line indicates multiple expected errors in one line - `W: ...` and `N: ...` works exactly like `E: ...`, but report a warning and a note respectively - lines that don't contain the above should cause no type check errors From 47f82d425f230a258d367cf8111793dc9d8a2f69 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 30 Jul 2025 19:25:12 -0400 Subject: [PATCH 03/15] Update data.py: continue implementing optional spacedness --- mypy/test/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index 5b0ad84c0ba7..5b74a31dc695 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -533,7 +533,7 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: for i in range(len(input)): # The first in the split things isn't a comment - for possible_err_comment in input[i].split(" # ")[1:]: + for possible_err_comment in input[i].split("(?!\\)#")[1:]: m = re.search( r"^([ENW]):((?P\d+):)? (?P.*)$", possible_err_comment.strip() ) From 25b28c97f006e5972324404f043fd30591741ce5 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 30 Jul 2025 19:52:52 -0400 Subject: [PATCH 04/15] Update data.py: actually use re split --- mypy/test/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index 5b74a31dc695..cc2fd44fbf15 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -533,7 +533,7 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: for i in range(len(input)): # The first in the split things isn't a comment - for possible_err_comment in input[i].split("(?!\\)#")[1:]: + for possible_err_comment in re.split("(?!\\)#", input[i])[1:]: m = re.search( r"^([ENW]):((?P\d+):)? (?P.*)$", possible_err_comment.strip() ) From 9705f734205013ebff5206f6863e7f7adf56f651 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 30 Jul 2025 19:55:46 -0400 Subject: [PATCH 05/15] Update data.py: use raw strings --- mypy/test/data.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index cc2fd44fbf15..671667e34892 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -533,7 +533,7 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: for i in range(len(input)): # The first in the split things isn't a comment - for possible_err_comment in re.split("(?!\\)#", input[i])[1:]: + for possible_err_comment in re.split(r"(?!\\)#", input[i])[1:]: m = re.search( r"^([ENW]):((?P\d+):)? (?P.*)$", possible_err_comment.strip() ) @@ -546,7 +546,7 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: severity = "warning" col = m.group("col") message = m.group("message") - message = message.replace("\\#", "#") # adds back escaped # character + message = message.replace(r"\#", "#") # adds back escaped # character if col is None: output.append(f"{fnam}:{i + 1}: {severity}: {message}") else: From 59a14cb5433399bdc8ba32b8cb73700213b9ae2c Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 30 Jul 2025 19:57:46 -0400 Subject: [PATCH 06/15] Update README.md: remember that markdown also uses backslash escapes --- test-data/unit/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-data/unit/README.md b/test-data/unit/README.md index 1c9aa73dcfb6..62556e9f420b 100644 --- a/test-data/unit/README.md +++ b/test-data/unit/README.md @@ -31,7 +31,7 @@ with text "abc..." - note a space after `E:` and `flags:` - `# E:12` adds column number to the expected error - use `\` to escape the `#` character and indicate that the rest of the line is part of -the error message (note that there is no support for using \\ to escape a backslash) +the error message (note that there is no support for using `\\` to escape a backslash itself) - repeating `# E: ` several times in one line indicates multiple expected errors in one line - `W: ...` and `N: ...` works exactly like `E: ...`, but report a warning and a note respectively - lines that don't contain the above should cause no type check errors From ba6afdb6ccc0752dfbf5598aafd1991140e682fe Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Wed, 30 Jul 2025 22:49:37 -0700 Subject: [PATCH 07/15] be more strict, but also more lenient, about error code comment format --- mypy/test/data.py | 4 ++-- mypy/test/update_data.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index 671667e34892..3dbbe223ebbb 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -533,9 +533,9 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: for i in range(len(input)): # The first in the split things isn't a comment - for possible_err_comment in re.split(r"(?!\\)#", input[i])[1:]: + for possible_err_comment in re.split(r"(?!\\)#\s*(?=[ENW]\s*:)", input[i])[1:]: m = re.search( - r"^([ENW]):((?P\d+):)? (?P.*)$", possible_err_comment.strip() + r"^([ENW])\s*:((?P\d+):)?\s*(?P.*)$", possible_err_comment.strip() ) if m: if m.group(1) == "E": diff --git a/mypy/test/update_data.py b/mypy/test/update_data.py index 2e04444d56e0..78a2250877ca 100644 --- a/mypy/test/update_data.py +++ b/mypy/test/update_data.py @@ -64,7 +64,7 @@ def _iter_fixes( fix_lines = [] for lineno, source_line in enumerate(source_lines, start=1): reports = reports_by_line.get((file_path, lineno)) - comment_match = re.search(r"(?P\s+)(?P# ?[EWN]: .+)$", source_line) + comment_match = re.search(r"(?P\s+)(?P#\s*[EWN]\s*:.+)$", source_line) if comment_match: source_line = source_line[: comment_match.start("indent")] # strip old comment if reports: From 467fdf146712eea30115f3f0f3b626d6048d820a Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 31 Jul 2025 00:51:42 -0700 Subject: [PATCH 08/15] message may include leading spaces --- mypy/test/data.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index 3dbbe223ebbb..adbc4a147636 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -535,7 +535,7 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: # The first in the split things isn't a comment for possible_err_comment in re.split(r"(?!\\)#\s*(?=[ENW]\s*:)", input[i])[1:]: m = re.search( - r"^([ENW])\s*:((?P\d+):)?\s*(?P.*)$", possible_err_comment.strip() + r"^([ENW])\s*:((?P\d+):)?(?P.*)$", possible_err_comment.strip() ) if m: if m.group(1) == "E": @@ -545,12 +545,12 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: elif m.group(1) == "W": severity = "warning" col = m.group("col") - message = m.group("message") + message = m.group("message") # Message may, and probably does, include leading spaces message = message.replace(r"\#", "#") # adds back escaped # character if col is None: - output.append(f"{fnam}:{i + 1}: {severity}: {message}") + output.append(f"{fnam}:{i + 1}: {severity}:{message}") else: - output.append(f"{fnam}:{i + 1}:{col}: {severity}: {message}") + output.append(f"{fnam}:{i + 1}:{col}: {severity}:{message}") def fix_win_path(line: str) -> str: From a56bebc01c819540a1d1e540d8156140eee05098 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 07:54:37 +0000 Subject: [PATCH 09/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mypy/test/data.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index adbc4a147636..40befc0d1931 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -545,7 +545,9 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: elif m.group(1) == "W": severity = "warning" col = m.group("col") - message = m.group("message") # Message may, and probably does, include leading spaces + message = m.group( + "message" + ) # Message may, and probably does, include leading spaces message = message.replace(r"\#", "#") # adds back escaped # character if col is None: output.append(f"{fnam}:{i + 1}: {severity}:{message}") From a429c05aa4c5d6e9de1f05d6d185e31c8ccb293b Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 31 Jul 2025 03:55:42 -0400 Subject: [PATCH 10/15] Handle zero-indent case in rewrite --- mypy/test/update_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/test/update_data.py b/mypy/test/update_data.py index 78a2250877ca..9269d3380543 100644 --- a/mypy/test/update_data.py +++ b/mypy/test/update_data.py @@ -64,7 +64,7 @@ def _iter_fixes( fix_lines = [] for lineno, source_line in enumerate(source_lines, start=1): reports = reports_by_line.get((file_path, lineno)) - comment_match = re.search(r"(?P\s+)(?P#\s*[EWN]\s*:.+)$", source_line) + comment_match = re.search(r"(?P\s*)(?P#\s*[EWN]\s*:.+)$", source_line) if comment_match: source_line = source_line[: comment_match.start("indent")] # strip old comment if reports: From 796adda9f8d8dc0d634291c4dff071e7a15dec99 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 31 Jul 2025 01:51:05 -0700 Subject: [PATCH 11/15] fix broken tests, elaborate on test file format in the readme --- test-data/unit/README.md | 16 +++++++++++----- test-data/unit/check-classes.test | 2 +- test-data/unit/check-deprecated.test | 3 ++- test-data/unit/check-newsemanal.test | 2 +- test-data/unit/check-type-aliases.test | 17 +++++++++++------ test-data/unit/check-typeddict.test | 2 +- 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/test-data/unit/README.md b/test-data/unit/README.md index 62556e9f420b..e9605d87234e 100644 --- a/test-data/unit/README.md +++ b/test-data/unit/README.md @@ -31,17 +31,23 @@ with text "abc..." - note a space after `E:` and `flags:` - `# E:12` adds column number to the expected error - use `\` to escape the `#` character and indicate that the rest of the line is part of -the error message (note that there is no support for using `\\` to escape a backslash itself) + the error message (note that there is no support for using `\\` to escape a backslash itself + in this context; also, in all other contexts, such as line-continuation, the backslash is treated + as it normally would be in a python source file) - repeating `# E: ` several times in one line indicates multiple expected errors in one line - `W: ...` and `N: ...` works exactly like `E: ...`, but report a warning and a note respectively - lines that don't contain the above should cause no type check errors +- lines that begin with `--` are test-file-format comments, and will not appear in the texted python + source code +- some test files are run in a special way by the test runner; this is typically documented in + test-file-format comments at the top of the test file - optional `[builtins fixtures/...]` tells the type checker to use `builtins` stubs from the indicated file (see Fixtures section below) - optional `[out]` is an alternative to the `# E: ` notation: it indicates that -any text after it contains the expected type checking error messages. -Usually, `# E: ` is preferred because it makes it easier to associate the -errors with the code generating them at a glance, and to change the code of -the test without having to change line numbers in `[out]` + any text after it contains the expected type checking error messages. + Usually, `# E: ` is preferred because it makes it easier to associate the + errors with the code generating them at a glance, and to change the code of + the test without having to change line numbers in `[out]` - an empty `[out]` section has no effect - to add tests for a feature that hasn't been implemented yet, append `-xfail` to the end of the test name diff --git a/test-data/unit/check-classes.test b/test-data/unit/check-classes.test index f713fe69bcd2..a9f81e54d5a6 100644 --- a/test-data/unit/check-classes.test +++ b/test-data/unit/check-classes.test @@ -695,7 +695,7 @@ class A: def __replace__(self, x: Optional[str]) -> Self: pass class B(A): - def __replace__(self, x: str) -> Self: pass # E: \ + def __replace__(self, x: str) -> Self: pass \ # E: Argument 1 of "__replace__" is incompatible with supertype "A"; supertype defines the argument type as "Optional[str]" [override] \ # N: This violates the Liskov substitution principle \ # N: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides diff --git a/test-data/unit/check-deprecated.test b/test-data/unit/check-deprecated.test index e1173ac425ba..0ceb3ce4a2c4 100644 --- a/test-data/unit/check-deprecated.test +++ b/test-data/unit/check-deprecated.test @@ -49,7 +49,8 @@ from typing_extensions import deprecated @deprecated("use f2 instead") def f() -> None: ... -f # E: function __main__.f is deprecated: use f2 instead # type: ignore[deprecated] +f # type: ignore[deprecated] +f # E: function __main__.f is deprecated: use f2 instead f(1) # E: function __main__.f is deprecated: use f2 instead \ # E: Too many arguments for "f" f[1] # E: function __main__.f is deprecated: use f2 instead \ diff --git a/test-data/unit/check-newsemanal.test b/test-data/unit/check-newsemanal.test index 61bf08018722..a7564e476804 100644 --- a/test-data/unit/check-newsemanal.test +++ b/test-data/unit/check-newsemanal.test @@ -2684,7 +2684,7 @@ class C: ) -> str: return 0 # E: Incompatible return value type (got "int", expected "str") -reveal_type(C.X) # E: # N: Revealed type is "def () -> __main__.X" +reveal_type(C.X) # N: Revealed type is "def () -> __main__.X" reveal_type(C().str()) # N: Revealed type is "builtins.str" [case testNewAnalyzerNameNotDefinedYetInClassBody] diff --git a/test-data/unit/check-type-aliases.test b/test-data/unit/check-type-aliases.test index 5bbb503a578a..e917e83e004b 100644 --- a/test-data/unit/check-type-aliases.test +++ b/test-data/unit/check-type-aliases.test @@ -551,12 +551,7 @@ def take_id(x: Id[int]) -> None: def id(x: Id[T]) -> T: return x -# TODO: This doesn't work and maybe it should? -# Indirection = AnInt[T] -# y: Indirection[str] -# reveal_type(y) # E : Revealed type is "builtins.int" - -# But this does +# Contrast with the TODO below Indirection2 = FlexibleAlias[T, AnInt[T]] z: Indirection2[str] reveal_type(z) # N: Revealed type is "builtins.int" @@ -567,6 +562,16 @@ reveal_type(w) # N: Revealed type is "builtins.int" [builtins fixtures/dict.pyi] +[case testFlexibleAlias1Todo-xfail] +# TODO: This doesn't work and maybe it should? +# Contrast with the example above that mentions this todo +T = TypeVar('T') +AnInt = FlexibleAlias[T, int] +Indirection = AnInt[T] +y: Indirection[str] +reveal_type(y) # N : Revealed type is "builtins.int" + + [case testFlexibleAlias2] # flags: --always-true=BOGUS from typing import TypeVar, Any diff --git a/test-data/unit/check-typeddict.test b/test-data/unit/check-typeddict.test index be5a6c655d8c..6676d23f087d 100644 --- a/test-data/unit/check-typeddict.test +++ b/test-data/unit/check-typeddict.test @@ -3652,7 +3652,7 @@ reveal_type(X) # N: Revealed type is "builtins.dict[builtins.str, def () -> bui from typing_extensions import TypeAlias X: TypeAlias = {"int": int, "str": str} x: X -reveal_type(x) # N: # N: Revealed type is "TypedDict({'int': builtins.int, 'str': builtins.str})" +reveal_type(x) # N: Revealed type is "TypedDict({'int': builtins.int, 'str': builtins.str})" [builtins fixtures/dict.pyi] [typing fixtures/typing-typeddict.pyi] From 33504bbcd455e68e22d24fcfe718fba7af9f473c Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 31 Jul 2025 02:02:30 -0700 Subject: [PATCH 12/15] I hate black param wrapping on things that should be a single line --- mypy/test/data.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index 40befc0d1931..73019cfbbd25 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -545,10 +545,9 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: elif m.group(1) == "W": severity = "warning" col = m.group("col") - message = m.group( - "message" - ) # Message may, and probably does, include leading spaces + message = m.group("message") message = message.replace(r"\#", "#") # adds back escaped # character + # Message may, and probably does, include leading spaces if col is None: output.append(f"{fnam}:{i + 1}: {severity}:{message}") else: From 1bc3676606ba02d90dc5ec01c14daf17e0280d29 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 31 Jul 2025 02:22:46 -0700 Subject: [PATCH 13/15] make tests --- test-data/unit/check-error-comments.test | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 test-data/unit/check-error-comments.test diff --git a/test-data/unit/check-error-comments.test b/test-data/unit/check-error-comments.test new file mode 100644 index 000000000000..cdca54d13583 --- /dev/null +++ b/test-data/unit/check-error-comments.test @@ -0,0 +1,54 @@ +[case noErrorComment] +x: int = 1 + +[case prototypicalErrorComment] +x: int = "hi" # E: Incompatible types in assignment (expression has type "str", variable has type "int") + +[case emptyLineErrorComment-xfail] +# E: + +[case oddErrorComments] +x: int = "hi"#E: Incompatible types in assignment (expression has type "str", variable has type "int") +x2: int = "hi" #E: Incompatible types in assignment (expression has type "str", variable has type "int") +x3: int = "hi" # E: Incompatible types in assignment (expression has type "str", variable has type "int") +x4: int = "hi" # E : Incompatible types in assignment (expression has type "str", variable has type "int") +x5: int = "hi" # E : Incompatible types in assignment (expression has type "str", variable has type "int") +x6: int = "hi" # E : Incompatible types in assignment (expression has type "str", variable has type "int") +x7: int = "hi" # E : Incompatible types in assignment (expression has type "str", variable has type "int") +x8: int = "hi" \ + # E : Incompatible types in assignment (expression has type "str", variable has type "int") +x82: int = "hi"\ +# E : Incompatible types in assignment (expression has type "str", variable has type "int") + +[case oddErrorCommentsNoteComment] +n: int +reveal_type(n) # N: Revealed type is "builtins.int" + + +[case oddErrorCommentsThatDontWork-xfail] +-- The space between the ":" and the message actually differs in the output, which we match against +-- so we can't just parse it and replace it; therefore, these do not work. +x: int = "hi"#E:Incompatible types in assignment (expression has type "str", variable has type "int") +x2: int = "hi" #E:Incompatible types in assignment (expression has type "str", variable has type "int") +x3: int = "hi" # E : Incompatible types in assignment (expression has type "str", variable has type "int") +x4: int = "hi" # E : Incompatible types in assignment (expression has type "str", variable has type "int") +x5: int = "hi" # E : Incompatible types in assignment (expression has type "str", variable has type "int") + +[case oddErrorCommentsThatDontWorkCase-xfail] +-- I just didn't bother to implement these. +x: int = "hi" # e: Incompatible types in assignment (expression has type "str", variable has type "int") +x: int = "hi" # w: Incompatible types in assignment (expression has type "str", variable has type "int") +x: int = "hi" # n: Incompatible types in assignment (expression has type "str", variable has type "int") + + +[case oddErrorCommentsThatDontWorkCaseAndNoColon-xfail] +-- I didn't implment these. This is veering towards the ambiguous. +x: int = "hi" # e: Incompatible types in assignment (expression has type "str", variable has type "int") +x2: int = "hi" # E Incompatible types in assignment (expression has type "str", variable has type "int") +x3: int = "hi" # e Incompatible types in assignment (expression has type "str", variable has type "int") +x4: int = "hi" # e Incompatible types in assignment (expression has type "str", variable has type "int") + + + + + From fd636a1c7ea79d3255398a96e59df73bb67c206f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 09:28:58 +0000 Subject: [PATCH 14/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- mypy/test/data.py | 2 +- test-data/unit/check-error-comments.test | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/mypy/test/data.py b/mypy/test/data.py index 73019cfbbd25..22c39af04ec1 100644 --- a/mypy/test/data.py +++ b/mypy/test/data.py @@ -545,7 +545,7 @@ def expand_errors(input: list[str], output: list[str], fnam: str) -> None: elif m.group(1) == "W": severity = "warning" col = m.group("col") - message = m.group("message") + message = m.group("message") message = message.replace(r"\#", "#") # adds back escaped # character # Message may, and probably does, include leading spaces if col is None: diff --git a/test-data/unit/check-error-comments.test b/test-data/unit/check-error-comments.test index cdca54d13583..2689530e84c6 100644 --- a/test-data/unit/check-error-comments.test +++ b/test-data/unit/check-error-comments.test @@ -5,7 +5,7 @@ x: int = 1 x: int = "hi" # E: Incompatible types in assignment (expression has type "str", variable has type "int") [case emptyLineErrorComment-xfail] -# E: +# E: [case oddErrorComments] x: int = "hi"#E: Incompatible types in assignment (expression has type "str", variable has type "int") @@ -47,8 +47,3 @@ x: int = "hi" # e: Incompatible types in assignment (expression has type "str", x2: int = "hi" # E Incompatible types in assignment (expression has type "str", variable has type "int") x3: int = "hi" # e Incompatible types in assignment (expression has type "str", variable has type "int") x4: int = "hi" # e Incompatible types in assignment (expression has type "str", variable has type "int") - - - - - From 55f3e6802da0c086bbc66aa3e20ef54a8d552e46 Mon Sep 17 00:00:00 2001 From: wyattscarpenter Date: Thu, 31 Jul 2025 02:30:04 -0700 Subject: [PATCH 15/15] typo --- test-data/unit/README.md | 2 +- test-data/unit/check-error-comments.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test-data/unit/README.md b/test-data/unit/README.md index e9605d87234e..1ca66a60caac 100644 --- a/test-data/unit/README.md +++ b/test-data/unit/README.md @@ -37,7 +37,7 @@ with text "abc..." - repeating `# E: ` several times in one line indicates multiple expected errors in one line - `W: ...` and `N: ...` works exactly like `E: ...`, but report a warning and a note respectively - lines that don't contain the above should cause no type check errors -- lines that begin with `--` are test-file-format comments, and will not appear in the texted python +- lines that begin with `--` are test-file-format comments, and will not appear in the tested python source code - some test files are run in a special way by the test runner; this is typically documented in test-file-format comments at the top of the test file diff --git a/test-data/unit/check-error-comments.test b/test-data/unit/check-error-comments.test index 2689530e84c6..948f7660fa59 100644 --- a/test-data/unit/check-error-comments.test +++ b/test-data/unit/check-error-comments.test @@ -42,7 +42,7 @@ x: int = "hi" # n: Incompatible types in assignment (expression has type "str", [case oddErrorCommentsThatDontWorkCaseAndNoColon-xfail] --- I didn't implment these. This is veering towards the ambiguous. +-- I didn't implement these. This is veering towards the ambiguous. x: int = "hi" # e: Incompatible types in assignment (expression has type "str", variable has type "int") x2: int = "hi" # E Incompatible types in assignment (expression has type "str", variable has type "int") x3: int = "hi" # e Incompatible types in assignment (expression has type "str", variable has type "int")