typecheck: validate method field return types
This commit is contained in:
@@ -77,6 +77,10 @@ class ValidateTypecheckDiagnosticsTests(unittest.TestCase):
|
||||
self.assertIn("tests/typecheck_method_return_expression_bad.claro", MODULE.EXPECTED)
|
||||
self.assertIn("tests/typecheck_method_return_expression_good.claro", MODULE.EXPECTED_OK)
|
||||
|
||||
def test_includes_method_field_return_diagnostic_fixture(self):
|
||||
self.assertIn("tests/typecheck_method_field_return_bad.claro", MODULE.EXPECTED)
|
||||
self.assertIn("tests/typecheck_method_field_return_good.claro", MODULE.EXPECTED_OK)
|
||||
|
||||
def test_includes_compatibility_method_return_success_fixture(self):
|
||||
self.assertIn("tests/typecheck_method_compat_return_good.claro", MODULE.EXPECTED_OK)
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
CLASS Player
|
||||
HAS score NUMBER
|
||||
|
||||
TEACH label RETURNS TEXT
|
||||
RETURN score
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,7 @@
|
||||
CLASS Player
|
||||
HAS score NUMBER
|
||||
|
||||
TEACH score_value RETURNS NUMBER
|
||||
RETURN score
|
||||
END
|
||||
END
|
||||
Reference in New Issue
Block a user