Exemple #1
0
        public void DetectsIncompatibleOperandsInOperation()
        {
            ITypeCheckExpr expr = tcFactory.Add(tcFactory.Bool(true), tcFactory.Int(100));

            ErrorManager errMngr = new ErrorManager();

            expr.TypeCheck(new TypeEnvironment(errMngr));

            Assert.True(errMngr.HasErrors);
        }
Exemple #2
0
        public void DetectsNonBoolConditions()
        {
            ITypeCheckExpr expr = tcFactory.IfElse(tcFactory.Int(5), tcFactory.String("True"), tcFactory.String("False"));

            ErrorManager errMngr = new ErrorManager();

            expr.TypeCheck(new TypeEnvironment(errMngr));

            Assert.True(errMngr.HasErrors);
        }