local void testScobindConditionMulti(void) { Stab stabGlobal, stabFile, stab; AbSyn ab; initFile(); stabGlobal = stabNewGlobal(); stabFile = stabNewFile(stabGlobal); stab = stabPushLevel(stabFile, sposNone, STAB_LEVEL_LARGE); finiFile(); return; /* ideally, I'd like to test this here, but comsgNote (used for multiple defs) doesn't play nice. */ #if 0 AbSyn ab = abqParse("if A then { f: X == 1; f: X == 1}"); scopeBind(stab, ab); Symbol sym_f = symInternConst("f"); scobindTestCheckUnique(stab, sym_f); #endif }
local void testAblog() { initFile(); ablogDebug = 0; String Boolean_imp = "import from Boolean"; String C0_def = "C0: Category == with"; String C1_def = "C1: Category == C0 with"; String D0_def = "D0: C0 with == add"; String D1_def = "D1: C1 with == add"; StringList lines = listList(String)(5, Boolean_imp, C0_def, C1_def, D0_def, D1_def); AbSynList code = listCons(AbSyn)(stdtypes(), abqParseLines(lines)); AbSyn absyn = abNewSequenceL(sposNone, code); abPutUse(absyn, AB_Use_NoValue); Stab file = stabFile(); Stab stab = stabPushLevel(file, sposNone, STAB_LEVEL_LARGE); scopeBind(stab, absyn); typeInfer(stab, absyn); testTrue("Declare is sefo", abIsSefo(absyn)); testIntEqual("Error Count", 0, comsgErrorCount()); Syme C0 = uniqueMeaning(stab, "C0"); Syme C1 = uniqueMeaning(stab, "C1"); Syme D0 = uniqueMeaning(stab, "D0"); Syme D1 = uniqueMeaning(stab, "D1"); AbSyn sefo1 = has(abFrSyme(D1), abFrSyme(C1)); AbSyn sefo0 = has(abFrSyme(D1), abFrSyme(C0)); tiSefo(stab, sefo0); tiSefo(stab, sefo1); AbLogic cond0 = ablogFrSefo(sefo0); AbLogic cond1 = ablogFrSefo(sefo1); afprintf(dbOut, "Implies: %pAbLogic %pAbLogic %d\n", cond1, cond0, ablogImplies(cond1, cond0)); afprintf(dbOut, "Implies: %pAbLogic %pAbLogic %d\n", cond0, cond1, ablogImplies(cond0, cond1)); testTrue("00", ablogImplies(cond0, cond0)); testTrue("10", ablogImplies(cond1, cond0)); testFalse("01",ablogImplies(cond0, cond1)); testTrue("11", ablogImplies(cond1, cond1)); }
local void testScobind(void) { Stab stabGlobal, stabFile, stab; AbSyn ab; initFile(); stabGlobal = stabNewGlobal(); stabFile = stabNewFile(stabGlobal); stab = stabPushLevel(stabFile, sposNone, STAB_LEVEL_LARGE); ab = abqParse("X: with == add"); scopeBind(stab, ab); scobindTestCheckUnique(stab, symInternConst("X")); finiFile(); }
local void testScobindCondition(void) { Stab stabGlobal, stabFile, stab; AbSyn ab; Symbol sym_f; initFile(); stabGlobal = stabNewGlobal(); stabFile = stabNewFile(stabGlobal); stab = stabPushLevel(stabFile, sposNone, STAB_LEVEL_LARGE); ab = abqParse("if A then f: () -> ()"); scopeBind(stab, ab); sym_f = symInternConst("f"); scobindTestCheckUnique(stab, sym_f); finiFile(); }