1
1
from __future__ import annotations
2
2
3
- from collections import defaultdict
4
3
import functools
5
4
import re
6
5
import sys
7
6
from typing import TYPE_CHECKING
8
7
9
- from .. import exc
10
8
from ..exc import Base
11
9
from ..exc import BaseError
12
10
from ..exc import BaseWarning
16
14
from collections .abc import Callable
17
15
from collections .abc import Sequence
18
16
19
- from .source_location import SourceLocation
20
- from .type_propagation import TypeNotAllowedOnDevice
21
17
from helion .runtime .settings import Settings
22
18
23
19
ErrorOrWarning = BaseError | BaseWarning
@@ -39,9 +35,6 @@ def __init__(self, settings: Settings) -> None:
39
35
self .errors : list [BaseError ] = []
40
36
self .warnings : list [BaseWarning ] = []
41
37
self .ignores : tuple [type [BaseWarning ], ...] = tuple (settings .ignore_warnings )
42
- self .type_errors : dict [SourceLocation , list [exc .TypePropagationError ]] = (
43
- defaultdict (list )
44
- )
45
38
self .printed_warning = 0
46
39
47
40
def add (self , e : Base | type [Base ]) -> None :
@@ -61,18 +54,6 @@ def add(self, e: Base | type[Base]) -> None:
61
54
else :
62
55
raise TypeError (f"expected error or warning, got { type (e )} " )
63
56
64
- def add_type_error (self , type_info : TypeNotAllowedOnDevice ) -> None :
65
- """
66
- Add a type error to the list of type errors and to the errors list if it's the first occurrence.
67
-
68
- :param type_info: The TypeNotAllowedOnDevice object containing information about the type error.
69
- """
70
- locations = type_info .locations
71
- similar_errors = self .type_errors [locations [0 ]]
72
- similar_errors .append (e := exc .TypePropagationError (type_info , similar_errors ))
73
- if len (similar_errors ) == 1 :
74
- self .add (e )
75
-
76
57
def ignore (self , e : type [BaseWarning ]) -> None :
77
58
"""
78
59
Add a warning type to the ignore list.
0 commit comments