@@ -295,30 +295,24 @@ Bpl.NAryExpr FunctionCall(Bpl.IToken tok, BuiltinFunction f, Bpl.Type typeInstan
295
295
296
296
case BuiltinFunction . SetCard :
297
297
Contract . Assert ( args . Length == 1 ) ;
298
- Contract . Assert ( typeInstantiation == null ) ;
299
298
return FunctionCall ( tok , "Set#Card" , Bpl . Type . Int , args ) ;
300
299
case BuiltinFunction . SetEmpty : {
301
300
Contract . Assert ( args . Length == 0 ) ;
302
- Contract . Assert ( typeInstantiation != null ) ;
303
- Bpl . Type resultType = predef . SetType ( tok , true , typeInstantiation ) ;
301
+ Bpl . Type resultType = predef . SetType ;
304
302
return Bpl . Expr . CoerceType ( tok , FunctionCall ( tok , "Set#Empty" , resultType , args ) , resultType ) ;
305
303
}
306
304
case BuiltinFunction . SetUnionOne :
307
305
Contract . Assert ( args . Length == 2 ) ;
308
- Contract . Assert ( typeInstantiation != null ) ;
309
- return FunctionCall ( tok , "Set#UnionOne" , predef . SetType ( tok , true , typeInstantiation ) , args ) ;
306
+ return FunctionCall ( tok , "Set#UnionOne" , predef . SetType , args ) ;
310
307
case BuiltinFunction . SetUnion :
311
308
Contract . Assert ( args . Length == 2 ) ;
312
- Contract . Assert ( typeInstantiation != null ) ;
313
- return FunctionCall ( tok , "Set#Union" , predef . SetType ( tok , true , typeInstantiation ) , args ) ;
309
+ return FunctionCall ( tok , "Set#Union" , predef . SetType , args ) ;
314
310
case BuiltinFunction . SetIntersection :
315
311
Contract . Assert ( args . Length == 2 ) ;
316
- Contract . Assert ( typeInstantiation != null ) ;
317
- return FunctionCall ( tok , "Set#Intersection" , predef . SetType ( tok , true , typeInstantiation ) , args ) ;
312
+ return FunctionCall ( tok , "Set#Intersection" , predef . SetType , args ) ;
318
313
case BuiltinFunction . SetDifference :
319
314
Contract . Assert ( args . Length == 2 ) ;
320
- Contract . Assert ( typeInstantiation != null ) ;
321
- return FunctionCall ( tok , "Set#Difference" , predef . SetType ( tok , true , typeInstantiation ) , args ) ;
315
+ return FunctionCall ( tok , "Set#Difference" , predef . SetType , args ) ;
322
316
case BuiltinFunction . SetEqual :
323
317
Contract . Assert ( args . Length == 2 ) ;
324
318
Contract . Assert ( typeInstantiation == null ) ;
@@ -333,148 +327,114 @@ Bpl.NAryExpr FunctionCall(Bpl.IToken tok, BuiltinFunction f, Bpl.Type typeInstan
333
327
return FunctionCall ( tok , "Set#Disjoint" , Bpl . Type . Bool , args ) ;
334
328
case BuiltinFunction . ISetEmpty : {
335
329
Contract . Assert ( args . Length == 0 ) ;
336
- Contract . Assert ( typeInstantiation != null ) ;
337
- Bpl . Type resultType = predef . SetType ( tok , false , typeInstantiation ) ;
330
+ Bpl . Type resultType = predef . ISetType ;
338
331
return Bpl . Expr . CoerceType ( tok , FunctionCall ( tok , "ISet#Empty" , resultType , args ) , resultType ) ;
339
332
}
340
333
case BuiltinFunction . ISetUnionOne :
341
334
Contract . Assert ( args . Length == 2 ) ;
342
- Contract . Assert ( typeInstantiation != null ) ;
343
- return FunctionCall ( tok , "ISet#UnionOne" , predef . SetType ( tok , false , typeInstantiation ) , args ) ;
335
+ return FunctionCall ( tok , "ISet#UnionOne" , predef . ISetType , args ) ;
344
336
case BuiltinFunction . ISetUnion :
345
337
Contract . Assert ( args . Length == 2 ) ;
346
- Contract . Assert ( typeInstantiation != null ) ;
347
- return FunctionCall ( tok , "ISet#Union" , predef . SetType ( tok , false , typeInstantiation ) , args ) ;
338
+ return FunctionCall ( tok , "ISet#Union" , predef . ISetType , args ) ;
348
339
case BuiltinFunction . ISetIntersection :
349
340
Contract . Assert ( args . Length == 2 ) ;
350
- Contract . Assert ( typeInstantiation != null ) ;
351
- return FunctionCall ( tok , "ISet#Intersection" , predef . SetType ( tok , false , typeInstantiation ) , args ) ;
341
+ return FunctionCall ( tok , "ISet#Intersection" , predef . ISetType , args ) ;
352
342
case BuiltinFunction . ISetDifference :
353
343
Contract . Assert ( args . Length == 2 ) ;
354
- Contract . Assert ( typeInstantiation != null ) ;
355
- return FunctionCall ( tok , "ISet#Difference" , predef . SetType ( tok , false , typeInstantiation ) , args ) ;
344
+ return FunctionCall ( tok , "ISet#Difference" , predef . ISetType , args ) ;
356
345
case BuiltinFunction . ISetEqual :
357
346
Contract . Assert ( args . Length == 2 ) ;
358
- Contract . Assert ( typeInstantiation == null ) ;
359
347
return FunctionCall ( tok , "ISet#Equal" , Bpl . Type . Bool , args ) ;
360
348
case BuiltinFunction . ISetSubset :
361
349
Contract . Assert ( args . Length == 2 ) ;
362
- Contract . Assert ( typeInstantiation == null ) ;
363
350
return FunctionCall ( tok , "ISet#Subset" , Bpl . Type . Bool , args ) ;
364
351
case BuiltinFunction . ISetDisjoint :
365
352
Contract . Assert ( args . Length == 2 ) ;
366
- Contract . Assert ( typeInstantiation == null ) ;
367
353
return FunctionCall ( tok , "ISet#Disjoint" , Bpl . Type . Bool , args ) ;
368
354
case BuiltinFunction . MultiSetCard :
369
355
Contract . Assert ( args . Length == 1 ) ;
370
- Contract . Assert ( typeInstantiation == null ) ;
371
356
return FunctionCall ( tok , "MultiSet#Card" , Bpl . Type . Int , args ) ;
372
357
case BuiltinFunction . MultiSetEmpty : {
373
358
Contract . Assert ( args . Length == 0 ) ;
374
- Contract . Assert ( typeInstantiation != null ) ;
375
- Bpl . Type resultType = predef . MultiSetType ( tok , typeInstantiation ) ;
359
+ Bpl . Type resultType = predef . MultiSetType ;
376
360
return Bpl . Expr . CoerceType ( tok , FunctionCall ( tok , "MultiSet#Empty" , resultType , args ) , resultType ) ;
377
361
}
378
362
case BuiltinFunction . MultiSetUnionOne :
379
363
Contract . Assert ( args . Length == 2 ) ;
380
- Contract . Assert ( typeInstantiation != null ) ;
381
- return FunctionCall ( tok , "MultiSet#UnionOne" , predef . MultiSetType ( tok , typeInstantiation ) , args ) ;
364
+ return FunctionCall ( tok , "MultiSet#UnionOne" , predef . MultiSetType , args ) ;
382
365
case BuiltinFunction . MultiSetUnion :
383
366
Contract . Assert ( args . Length == 2 ) ;
384
- Contract . Assert ( typeInstantiation != null ) ;
385
- return FunctionCall ( tok , "MultiSet#Union" , predef . MultiSetType ( tok , typeInstantiation ) , args ) ;
367
+ return FunctionCall ( tok , "MultiSet#Union" , predef . MultiSetType , args ) ;
386
368
case BuiltinFunction . MultiSetIntersection :
387
369
Contract . Assert ( args . Length == 2 ) ;
388
- Contract . Assert ( typeInstantiation != null ) ;
389
- return FunctionCall ( tok , "MultiSet#Intersection" , predef . MultiSetType ( tok , typeInstantiation ) , args ) ;
370
+ return FunctionCall ( tok , "MultiSet#Intersection" , predef . MultiSetType , args ) ;
390
371
case BuiltinFunction . MultiSetDifference :
391
372
Contract . Assert ( args . Length == 2 ) ;
392
- Contract . Assert ( typeInstantiation != null ) ;
393
- return FunctionCall ( tok , "MultiSet#Difference" , predef . MultiSetType ( tok , typeInstantiation ) , args ) ;
373
+ return FunctionCall ( tok , "MultiSet#Difference" , predef . MultiSetType , args ) ;
394
374
case BuiltinFunction . MultiSetEqual :
395
375
Contract . Assert ( args . Length == 2 ) ;
396
- Contract . Assert ( typeInstantiation == null ) ;
397
376
return FunctionCall ( tok , "MultiSet#Equal" , Bpl . Type . Bool , args ) ;
398
377
case BuiltinFunction . MultiSetSubset :
399
378
Contract . Assert ( args . Length == 2 ) ;
400
- Contract . Assert ( typeInstantiation == null ) ;
401
379
return FunctionCall ( tok , "MultiSet#Subset" , Bpl . Type . Bool , args ) ;
402
380
case BuiltinFunction . MultiSetDisjoint :
403
381
Contract . Assert ( args . Length == 2 ) ;
404
- Contract . Assert ( typeInstantiation == null ) ;
405
382
return FunctionCall ( tok , "MultiSet#Disjoint" , Bpl . Type . Bool , args ) ;
406
383
case BuiltinFunction . MultiSetFromSet :
407
384
Contract . Assert ( args . Length == 1 ) ;
408
- Contract . Assert ( typeInstantiation != null ) ;
409
- return FunctionCall ( tok , "MultiSet#FromSet" , predef . MultiSetType ( tok , typeInstantiation ) , args ) ;
385
+ return FunctionCall ( tok , "MultiSet#FromSet" , predef . MultiSetType , args ) ;
410
386
case BuiltinFunction . MultiSetFromSeq :
411
387
Contract . Assert ( args . Length == 1 ) ;
412
- Contract . Assert ( typeInstantiation != null ) ;
413
- return FunctionCall ( tok , "MultiSet#FromSeq" , predef . MultiSetType ( tok , typeInstantiation ) , args ) ;
388
+ return FunctionCall ( tok , "MultiSet#FromSeq" , predef . MultiSetType , args ) ;
414
389
case BuiltinFunction . IsGoodMultiSet :
415
390
Contract . Assert ( args . Length == 1 ) ;
416
- Contract . Assert ( typeInstantiation == null ) ;
417
391
return FunctionCall ( tok , "$IsGoodMultiSet" , Bpl . Type . Bool , args ) ;
418
392
419
393
case BuiltinFunction . SeqLength :
420
394
Contract . Assert ( args . Length == 1 ) ;
421
- Contract . Assert ( typeInstantiation == null ) ;
422
395
return FunctionCall ( tok , "Seq#Length" , Bpl . Type . Int , args ) ;
423
396
case BuiltinFunction . SeqEmpty : {
424
397
Contract . Assert ( args . Length == 0 ) ;
425
- Contract . Assert ( typeInstantiation != null ) ;
426
- Bpl . Type resultType = predef . SeqType ( tok , typeInstantiation ) ;
398
+ Bpl . Type resultType = predef . SeqType ;
427
399
return Bpl . Expr . CoerceType ( tok , FunctionCall ( tok , "Seq#Empty" , resultType , args ) , resultType ) ;
428
400
}
429
401
case BuiltinFunction . SeqBuild :
430
402
Contract . Assert ( args . Length == 2 ) ;
431
- Contract . Assert ( typeInstantiation != null ) ;
432
- return FunctionCall ( tok , "Seq#Build" , predef . SeqType ( tok , typeInstantiation ) , args ) ;
403
+ return FunctionCall ( tok , "Seq#Build" , predef . SeqType , args ) ;
433
404
case BuiltinFunction . SeqAppend :
434
405
Contract . Assert ( args . Length == 2 ) ;
435
- Contract . Assert ( typeInstantiation != null ) ;
436
- return FunctionCall ( tok , "Seq#Append" , predef . SeqType ( tok , typeInstantiation ) , args ) ;
406
+ return FunctionCall ( tok , "Seq#Append" , predef . SeqType , args ) ;
437
407
case BuiltinFunction . SeqIndex :
438
408
Contract . Assert ( args . Length == 2 ) ;
439
- Contract . Assert ( typeInstantiation != null ) ;
440
- return FunctionCall ( tok , "Seq#Index" , typeInstantiation , args ) ;
409
+ return FunctionCall ( tok , "Seq#Index" , predef . BoxType , args ) ;
441
410
case BuiltinFunction . SeqUpdate :
442
411
Contract . Assert ( args . Length == 3 ) ;
443
- Contract . Assert ( typeInstantiation != null ) ;
444
- return FunctionCall ( tok , "Seq#Update" , predef . SeqType ( tok , typeInstantiation ) , args ) ;
412
+ return FunctionCall ( tok , "Seq#Update" , predef . SeqType , args ) ;
445
413
case BuiltinFunction . SeqContains :
446
414
Contract . Assert ( args . Length == 2 ) ;
447
- Contract . Assert ( typeInstantiation == null ) ;
448
415
return FunctionCall ( tok , "Seq#Contains" , Bpl . Type . Bool , args ) ;
449
416
case BuiltinFunction . SeqDrop :
450
417
Contract . Assert ( args . Length == 2 ) ;
451
- Contract . Assert ( typeInstantiation != null ) ;
452
- return FunctionCall ( tok , "Seq#Drop" , predef . SeqType ( tok , typeInstantiation ) , args ) ;
418
+ return FunctionCall ( tok , "Seq#Drop" , predef . SeqType , args ) ;
453
419
case BuiltinFunction . SeqTake :
454
420
Contract . Assert ( args . Length == 2 ) ;
455
- Contract . Assert ( typeInstantiation != null ) ;
456
- return FunctionCall ( tok , "Seq#Take" , predef . SeqType ( tok , typeInstantiation ) , args ) ;
421
+ return FunctionCall ( tok , "Seq#Take" , predef . SeqType , args ) ;
457
422
case BuiltinFunction . SeqEqual :
458
423
Contract . Assert ( args . Length == 2 ) ;
459
- Contract . Assert ( typeInstantiation == null ) ;
460
424
return FunctionCall ( tok , "Seq#Equal" , Bpl . Type . Bool , args ) ;
461
425
case BuiltinFunction . SeqSameUntil :
462
426
Contract . Assert ( args . Length == 3 ) ;
463
- Contract . Assert ( typeInstantiation == null ) ;
464
427
return FunctionCall ( tok , "Seq#SameUntil" , Bpl . Type . Bool , args ) ;
465
428
case BuiltinFunction . SeqFromArray :
466
429
Contract . Assert ( args . Length == 2 ) ;
467
- Contract . Assert ( typeInstantiation != null ) ;
468
430
return FunctionCall ( tok , "Seq#FromArray" , typeInstantiation , args ) ;
469
431
case BuiltinFunction . SeqRank :
470
432
Contract . Assert ( args . Length == 1 ) ;
471
- Contract . Assert ( typeInstantiation == null ) ;
472
433
return FunctionCall ( tok , "Seq#Rank" , Bpl . Type . Int , args ) ;
473
434
474
435
case BuiltinFunction . MapEmpty : {
475
436
Contract . Assert ( args . Length == 0 ) ;
476
- Contract . Assert ( typeInstantiation != null ) ;
477
- Bpl . Type resultType = predef . MapType ( tok , true , typeInstantiation , typeInstantiation ) ; // use 'typeInstantiation' (which is really always just BoxType anyway) as both type arguments
437
+ Bpl . Type resultType = predef . MapType ;
478
438
return Bpl . Expr . CoerceType ( tok , FunctionCall ( tok , "Map#Empty" , resultType , args ) , resultType ) ;
479
439
}
480
440
case BuiltinFunction . MapCard :
@@ -489,7 +449,7 @@ Bpl.NAryExpr FunctionCall(Bpl.IToken tok, BuiltinFunction f, Bpl.Type typeInstan
489
449
return FunctionCall ( tok , "Map#Elements" , typeInstantiation , args ) ;
490
450
case BuiltinFunction . MapGlue :
491
451
Contract . Assert ( args . Length == 3 ) ;
492
- return FunctionCall ( tok , "Map#Glue" , predef . MapType ( tok , true , predef . BoxType , predef . BoxType ) , args ) ;
452
+ return FunctionCall ( tok , "Map#Glue" , predef . MapType , args ) ;
493
453
case BuiltinFunction . MapEqual :
494
454
Contract . Assert ( args . Length == 2 ) ;
495
455
Contract . Assert ( typeInstantiation == null ) ;
@@ -505,8 +465,7 @@ Bpl.NAryExpr FunctionCall(Bpl.IToken tok, BuiltinFunction f, Bpl.Type typeInstan
505
465
506
466
case BuiltinFunction . IMapEmpty : {
507
467
Contract . Assert ( args . Length == 0 ) ;
508
- Contract . Assert ( typeInstantiation != null ) ;
509
- Bpl . Type resultType = predef . MapType ( tok , false , typeInstantiation , typeInstantiation ) ; // use 'typeInstantiation' (which is really always just BoxType anyway) as both type arguments
468
+ Bpl . Type resultType = predef . IMapType ;
510
469
return Bpl . Expr . CoerceType ( tok , FunctionCall ( tok , "IMap#Empty" , resultType , args ) , resultType ) ;
511
470
}
512
471
case BuiltinFunction . IMapDomain :
@@ -517,7 +476,7 @@ Bpl.NAryExpr FunctionCall(Bpl.IToken tok, BuiltinFunction f, Bpl.Type typeInstan
517
476
return FunctionCall ( tok , "IMap#Elements" , typeInstantiation , args ) ;
518
477
case BuiltinFunction . IMapGlue :
519
478
Contract . Assert ( args . Length == 3 ) ;
520
- return FunctionCall ( tok , "IMap#Glue" , predef . MapType ( tok , false , predef . BoxType , predef . BoxType ) , args ) ;
479
+ return FunctionCall ( tok , "IMap#Glue" , predef . IMapType , args ) ;
521
480
case BuiltinFunction . IMapEqual :
522
481
Contract . Assert ( args . Length == 2 ) ;
523
482
Contract . Assert ( typeInstantiation == null ) ;
@@ -526,11 +485,11 @@ Bpl.NAryExpr FunctionCall(Bpl.IToken tok, BuiltinFunction f, Bpl.Type typeInstan
526
485
case BuiltinFunction . IndexField :
527
486
Contract . Assert ( args . Length == 1 ) ;
528
487
Contract . Assert ( typeInstantiation == null ) ;
529
- return FunctionCall ( tok , "IndexField" , predef . FieldName ( tok , predef . BoxType ) , args ) ;
488
+ return FunctionCall ( tok , "IndexField" , predef . FieldName ( tok ) , args ) ;
530
489
case BuiltinFunction . MultiIndexField :
531
490
Contract . Assert ( args . Length == 2 ) ;
532
491
Contract . Assert ( typeInstantiation == null ) ;
533
- return FunctionCall ( tok , "MultiIndexField" , predef . FieldName ( tok , predef . BoxType ) , args ) ;
492
+ return FunctionCall ( tok , "MultiIndexField" , predef . FieldName ( tok ) , args ) ;
534
493
535
494
case BuiltinFunction . Box :
536
495
Contract . Assert ( args . Length == 1 ) ;
@@ -582,7 +541,7 @@ Bpl.NAryExpr FunctionCall(Bpl.IToken tok, BuiltinFunction f, Bpl.Type typeInstan
582
541
case BuiltinFunction . FieldOfDecl :
583
542
Contract . Assert ( args . Length == 2 ) ;
584
543
Contract . Assert ( typeInstantiation != null ) ;
585
- return FunctionCall ( tok , "FieldOfDecl" , predef . FieldName ( tok , typeInstantiation ) , args ) ;
544
+ return FunctionCall ( tok , "FieldOfDecl" , predef . FieldName ( tok ) , args ) ;
586
545
case BuiltinFunction . FDim :
587
546
Contract . Assert ( args . Length == 1 ) ;
588
547
Contract . Assert ( typeInstantiation != null ) ;
0 commit comments