Mon commit avec mes modifs à moi ! Na

This commit is contained in:
2022-10-26 11:51:37 +02:00
parent 52ce1488c5
commit 62d045512a
62 changed files with 2342 additions and 77 deletions
+6 -6
View File
@@ -110,7 +110,7 @@ class MiniCTypingVisitor(MiniCVisitor):
else:
self._raise(ctx,"boolean operator", fstT)
else:
self._assertSameType(ctx,"boolean operator", fstT,sndT)
self._raise(ctx,"boolean operator", fstT,sndT)
def visitAndExpr(self, ctx):
fstT = self.visit(ctx.expr(0))
@@ -121,7 +121,7 @@ class MiniCTypingVisitor(MiniCVisitor):
else:
self._raise(ctx,"boolean operator", fstT)
else:
self._assertSameType(ctx,"boolean operator", fstT,sndT)
self._raise(ctx,"boolean operator", fstT,sndT)
def visitEqualityExpr(self, ctx):
fstT = self.visit(ctx.expr(0))
@@ -140,7 +140,7 @@ class MiniCTypingVisitor(MiniCVisitor):
else:
self._raise(ctx, "comparaison operator", fstT)
else:
self._assertSameType(ctx,"comparaison operator", fstT,sndT)
self._raise(ctx,"comparaison operator", fstT,sndT)
def visitAdditiveExpr(self, ctx):
assert ctx.myop is not None
@@ -152,9 +152,9 @@ class MiniCTypingVisitor(MiniCVisitor):
elif (fstT == BaseType.String and ctx.myop.type == MiniCParser.PLUS):
return BaseType.String
else:
self._raise(ctx, "additive operands", fstT)
self._raise(ctx, "additive operands", fstT,sndT)
else:
self._assertSameType(ctx,"additive operator", fstT,sndT)
self._raise(ctx,"additive operator", fstT,sndT)
def visitMultiplicativeExpr(self, ctx):
fstT = self.visit(ctx.expr(0))
@@ -165,7 +165,7 @@ class MiniCTypingVisitor(MiniCVisitor):
else:
return fstT
else:
self._assertSameType(ctx,"multiplicative operator", fstT,sndT)
self._raise(ctx,"multiplicative operands", fstT,sndT)
def visitNotExpr(self, ctx):
fstT = self.visit(ctx.expr())
@@ -11,4 +11,4 @@ int main(){
// EXITCODE 2
// EXPECTED
// In function main: Line 8 col 6: type mismatch for multiplicative operator: integer and string
// In function main: Line 8 col 6: invalid type for multiplicative operands: integer and string
@@ -6,4 +6,4 @@ int main(){
}
// EXITCODE 2
// EXPECTED
// In function main: Line 4 col 14: invalid type for additive operands: boolean
// In function main: Line 4 col 14: invalid type for additive operands: boolean and boolean
@@ -11,4 +11,4 @@ int main(){
// EXITCODE 2
// EXPECTED
// In function main: Line 6 col 12: type mismatch for additive operator: integer and boolean
// In function main: Line 6 col 12: invalid type for additive operator: integer and boolean
@@ -11,4 +11,4 @@ int main(){
// EXITCODE 2
// EXPECTED
// In function main: Line 8 col 8: invalid type for additive operands: boolean
// In function main: Line 8 col 8: invalid type for additive operands: boolean and boolean
@@ -13,4 +13,4 @@ int main(){
// EXITCODE 2
// EXPECTED
// In function main: Line 10 col 8: type mismatch for additive operator: integer and float
// In function main: Line 10 col 8: invalid type for additive operator: integer and float
@@ -11,4 +11,4 @@ int main(){
// EXITCODE 2
// EXPECTED
// In function main: Line 8 col 8: type mismatch for boolean operator: integer and boolean
// In function main: Line 8 col 8: invalid type for boolean operator: integer and boolean
@@ -19,4 +19,4 @@ int main(){
// EXITCODE 2
// EXPECTED
// In function main: Line 16 col 8: type mismatch for comparaison operator: integer and float
// In function main: Line 16 col 8: invalid type for comparaison operator: integer and float
@@ -13,4 +13,4 @@ int main(){
// EXITCODE 2
// EXPECTED
// In function main: Line 10 col 8: type mismatch for multiplicative operator: integer and float
// In function main: Line 10 col 8: invalid type for multiplicative operands: integer and float
@@ -11,4 +11,4 @@ int main(){
// EXITCODE 2
// EXPECTED
// In function main: Line 8 col 8: type mismatch for boolean operator: integer and boolean
// In function main: Line 8 col 8: invalid type for boolean operator: integer and boolean