Add tests, remove unused code, fix bugs

- Added tests for more error messages
- Test the "go to reference" feature at every character index of every
test case
- Delete unused code and imports
- Fix some bugs I found along the way
This commit is contained in:
James Westman 2024-12-22 18:00:39 -06:00
parent 5b0f662478
commit 9b9fab832b
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
47 changed files with 140 additions and 190 deletions

View file

@ -38,10 +38,6 @@ class ExprBase(AstNode):
def type(self) -> T.Optional[GirType]:
raise NotImplementedError()
@property
def type_complete(self) -> bool:
return True
@property
def rhs(self) -> T.Optional["ExprBase"]:
if isinstance(self.parent, Expression):
@ -65,10 +61,6 @@ class Expression(ExprBase):
def type(self) -> T.Optional[GirType]:
return self.last.type
@property
def type_complete(self) -> bool:
return self.last.type_complete
class InfixExpr(ExprBase):
@property
@ -99,15 +91,6 @@ class LiteralExpr(ExprBase):
def type(self) -> T.Optional[GirType]:
return self.literal.value.type
@property
def type_complete(self) -> bool:
from .values import IdentLiteral
if isinstance(self.literal.value, IdentLiteral):
if object := self.context[ScopeCtx].objects.get(self.literal.value.ident):
return not object.gir_class.incomplete
return True
class LookupOp(InfixExpr):
grammar = [".", UseIdent("property")]
@ -211,10 +194,6 @@ class CastExpr(InfixExpr):
def type(self) -> T.Optional[GirType]:
return self.children[TypeName][0].gir_type
@property
def type_complete(self) -> bool:
return True
@validate()
def cast_makes_sense(self):
if self.type is None or self.lhs.type is None: