this repo has no description

Add another generalization test

authored by bernsteinbear.com and committed by

Max Bernstein a3392df4 07257525

+6
+6
scrapscript.py
··· 4669 4669 ty = self.infer(expr, {}) 4670 4670 self.assertTyEqual(ty, func_type(TyVar("a"), TyVar("a"))) 4671 4671 4672 + def test_generalization2(self) -> None: 4673 + # From https://okmij.org/ftp/ML/generalization.html 4674 + expr = parse(tokenize("x -> (y . y = z -> x z)")) 4675 + ty = self.infer(expr, {}) 4676 + self.assertTyEqual(ty, func_type(func_type(TyVar("a"), TyVar("b")), func_type(TyVar("a"), TyVar("b")))) 4677 + 4672 4678 def test_id(self) -> None: 4673 4679 expr = Function(Var("x"), Var("x")) 4674 4680 ty = self.infer(expr, {})