this repo has no description

Add cons type

authored by bernsteinbear.com and committed by

Max Bernstein 40c9ca60 f6575eb4

+11
+11
scrapscript.py
··· 4558 4558 ty = infer_type(expr, {}) 4559 4559 self.assertTyEqual(ty, HoleType) 4560 4560 4561 + def test_string_concat(self) -> None: 4562 + expr = parse(tokenize('"a" ++ "b"')) 4563 + ty = infer_type(expr, OP_ENV) 4564 + self.assertTyEqual(ty, StringType) 4565 + 4566 + def test_cons(self) -> None: 4567 + expr = parse(tokenize("1 >+ [2]")) 4568 + ty = infer_type(expr, OP_ENV) 4569 + self.assertTyEqual(ty, list_type(IntType)) 4570 + 4561 4571 4562 4572 class SerializerTests(unittest.TestCase): 4563 4573 def _serialize(self, obj: Object) -> bytes: ··· 5321 5331 "*": Forall([], func_type(IntType, IntType, IntType)), 5322 5332 "/": Forall([], func_type(IntType, IntType, IntType)), 5323 5333 "++": Forall([], func_type(StringType, StringType, StringType)), 5334 + ">+": Forall([TyVar("a")], func_type(TyVar("a"), list_type(TyVar("a")), list_type(TyVar("a")))), 5324 5335 } 5325 5336 5326 5337