@@ -252,8 +252,6 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
252
252
auto &C = getASTContext ();
253
253
auto module = getParentModule ();
254
254
255
- auto decl = dyn_cast<NominalTypeDecl>(getParent ());
256
-
257
255
fprintf (stderr, " [%s:%d] (%s) ====================================================\n " , __FILE__, __LINE__, __FUNCTION__);
258
256
fprintf (stderr, " [%s:%d] (%s) ====================================================\n " , __FILE__, __LINE__, __FUNCTION__);
259
257
fprintf (stderr, " [%s:%d] (%s) ====================================================\n " , __FILE__, __LINE__, __FUNCTION__);
@@ -318,7 +316,7 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
318
316
319
317
// -- Check number of generic requirements
320
318
size_t expectedRequirementsNum = 3 ;
321
- auto serializationRequirementsNum = 0 ;
319
+ size_t serializationRequirementsNum = 0 ;
322
320
if (!isVoidReturn) {
323
321
serializationRequirementsNum = requirementProtos.size ();
324
322
expectedRequirementsNum += serializationRequirementsNum;
@@ -337,37 +335,32 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
337
335
// --- Check parameter: on: Actor
338
336
auto actorParam = params->get (0 );
339
337
if (actorParam->getArgumentName () != C.Id_on ) {
340
- fprintf (stderr, " [%s:%d] (%s) if (actorParam->getArgumentName() != C.Id_on)\n " , __FILE__, __LINE__, __FUNCTION__);
341
338
return false ;
342
339
}
343
340
344
341
// --- Check parameter: target RemoteCallTarget
345
342
auto targetParam = params->get (1 );
346
343
if (targetParam->getArgumentName () != C.Id_target ) {
347
- fprintf (stderr, " [%s:%d] (%s) if (targetParam->getArgumentName() != C.Id_target)\n " , __FILE__, __LINE__, __FUNCTION__);
348
344
return false ;
349
345
}
350
346
351
347
// --- Check parameter: invocation InvocationEncoder
352
348
// FIXME: NOT INOUT, but we crash today if not
353
349
auto invocationParam = params->get (2 );
354
350
if (invocationParam->getArgumentName () != C.Id_invocation ) {
355
- fprintf (stderr, " [%s:%d] (%s) if (invocationParam->getArgumentName() != C.Id_invocation) {\n " , __FILE__, __LINE__, __FUNCTION__);
356
351
return false ;
357
352
}
358
353
359
354
// --- Check parameter: throwing: Err.Type
360
355
auto thrownTypeParam = params->get (3 );
361
356
if (thrownTypeParam->getArgumentName () != C.Id_throwing ) {
362
- fprintf (stderr, " [%s:%d] (%s) if (thrownTypeParam->getArgumentName() != C.Id_throwing) {\n " , __FILE__, __LINE__, __FUNCTION__);
363
357
return false ;
364
358
}
365
359
366
360
// --- Check parameter: returning: Res.Type
367
361
if (!isVoidReturn) {
368
362
auto returnedTypeParam = params->get (4 );
369
363
if (returnedTypeParam->getArgumentName () != C.Id_returning ) {
370
- fprintf (stderr, " [%s:%d] (%s) if (thrownTypeParam->getArgumentName() != C.Id_throwing) {\n " , __FILE__, __LINE__, __FUNCTION__);
371
364
return false ;
372
365
}
373
366
}
@@ -384,7 +377,6 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
384
377
mapTypeIntoContext (ActParam->getDeclaredInterfaceType ()),
385
378
C.getProtocol (KnownProtocolKind::DistributedActor));
386
379
if (ActConformance.isInvalid ()) {
387
- fprintf (stderr, " [%s:%d] (%s) if (ActConformance.isInvalid()) {\n " , __FILE__, __LINE__, __FUNCTION__);
388
380
return false ;
389
381
}
390
382
@@ -394,7 +386,6 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
394
386
mapTypeIntoContext (ErrParam->getDeclaredInterfaceType ()),
395
387
C.getProtocol (KnownProtocolKind::Error));
396
388
if (ErrConformance.isInvalid ()) {
397
- fprintf (stderr, " [%s:%d] (%s) if (ErrConformance.isInvalid())\n " , __FILE__, __LINE__, __FUNCTION__);
398
389
return false ;
399
390
}
400
391
@@ -419,9 +410,6 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
419
410
}
420
411
421
412
if (requirements.size () != expectedRequirementsNum) {
422
- fprintf (stderr, " [%s:%d] (%s) requirements.size() = %d\n " , __FILE__, __LINE__, __FUNCTION__, requirements.size ());
423
- fprintf (stderr, " [%s:%d] (%s) expectedRequirementsNum = %d\n " , __FILE__, __LINE__, __FUNCTION__, expectedRequirementsNum);
424
- fprintf (stderr, " [%s:%d] (%s) if (requirements.size() != expectedRequirementsNum)\n " , __FILE__, __LINE__, __FUNCTION__);
425
413
return false ;
426
414
}
427
415
@@ -441,11 +429,9 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
441
429
->getInterfaceType ()
442
430
->getMetatypeInstanceType ();
443
431
if (actorReq.getKind () != RequirementKind::Conformance) {
444
- fprintf (stderr, " [%s:%d] (%s) if (actorReq.getKind() != RequirementKind::Conformance) {\n " , __FILE__, __LINE__, __FUNCTION__);
445
432
return false ;
446
433
}
447
434
if (!actorReq.getSecondType ()->isEqual (distActorTy)) {
448
- fprintf (stderr, " [%s:%d] (%s) if (actorReq.getSecondType()->isEqual(distActorTy)) {\n " , __FILE__, __LINE__, __FUNCTION__);
449
435
return false ;
450
436
}
451
437
@@ -455,47 +441,35 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
455
441
->getInterfaceType ()
456
442
->getMetatypeInstanceType ();
457
443
if (errorReq.getKind () != RequirementKind::Conformance) {
458
- fprintf (stderr, " [%s:%d] (%s) if (errorReq.getKind() != RequirementKind::Conformance) {\n " , __FILE__, __LINE__, __FUNCTION__);
459
444
return false ;
460
445
}
461
446
if (!errorReq.getSecondType ()->isEqual (errorTy)) {
462
- fprintf (stderr, " [%s:%d] (%s) if (errorReq.getSecondType()->isEqual(errorTy)) {\n " , __FILE__, __LINE__, __FUNCTION__);
463
447
return false ;
464
448
}
465
449
466
450
// --- Check requirement: Res either Void or all SerializationRequirements
467
451
if (isVoidReturn) {
468
452
if (auto func = dyn_cast<FuncDecl>(this )) {
469
453
if (!func->getResultInterfaceType ()->isVoid ()) {
470
- fprintf (stderr, " [%s:%d] (%s) if (!func->getResultInterfaceType()->isVoid()) {\n " , __FILE__, __LINE__, __FUNCTION__);
471
454
return false ;
472
455
}
473
456
}
474
457
} else if (ResParam) {
475
- // FIXME(distributed): implement checking return type for serialization requirement
476
458
assert (ResParam && " Non void function, yet no Res generic parameter found" );
477
459
if (auto func = dyn_cast<FuncDecl>(this )) {
478
- auto resultType = func->mapTypeIntoContext (func->getResultInterfaceType ());
460
+ auto resultType = func->mapTypeIntoContext (func->getResultInterfaceType ())
461
+ ->getMetatypeInstanceType ()
462
+ ->getDesugaredType ();
463
+ auto resultParamType = func->mapTypeIntoContext (
464
+ ResParam->getInterfaceType ()->getMetatypeInstanceType ());
479
465
// The result of the function must be the `Res` generic argument.
480
- if (!resultType->getMetatypeInstanceType ()->getDesugaredType ()->isEqual (
481
- func->mapTypeIntoContext (ResParam->getInterfaceType ()->getMetatypeInstanceType ()))) {
482
- fprintf (stderr, " [%s:%d] (%s) resultType->getMetatypeInstanceType()\n " , __FILE__, __LINE__, __FUNCTION__);
483
- resultType->getMetatypeInstanceType ().dump ();
484
- fprintf (stderr, " [%s:%d] (%s) ResParam->getInterfaceType()->getMetatypeInstanceType()\n " , __FILE__, __LINE__, __FUNCTION__);
485
- ResParam->getInterfaceType ()->getMetatypeInstanceType ().dump ();
486
-
487
- fprintf (stderr, " [%s:%d] (%s) if (!resultType->getMetatypeInstanceType()->isEqual(ResParam->getInterfaceType()->getMetatypeInstanceType()))\n " , __FILE__, __LINE__, __FUNCTION__);
466
+ if (!resultType->isEqual (resultParamType)) {
488
467
return false ;
489
468
}
490
469
491
- // FIXME: look at requirements
492
-
493
470
for (auto requirementProto : requirementProtos) {
494
471
auto conformance = module ->lookupConformance (resultType, requirementProto);
495
472
if (conformance.isInvalid ()) {
496
- // fprintf(stderr, "[%s:%d] (%s) %s missing conformance to %s\n", __FILE__, __LINE__, __FUNCTION__,
497
- // resultType->getAnyNominal()->getNameStr().str().c_str(),
498
- // requirementProto->getInterfaceType()->getAnyNominal()->getNameStr().str().c_str());
499
473
return false ;
500
474
}
501
475
}
@@ -505,18 +479,15 @@ bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall(bool isVoidReturn)
505
479
// -- Check requirement: same_type Actor.ID Self.ActorID
506
480
auto actorIdReq = requirements.back ();
507
481
if (actorIdReq.getKind () != RequirementKind::SameType) {
508
- fprintf (stderr, " [%s:%d] (%s) if (actorIdReq.getKind() != RequirementKind::SameType){ \n " , __FILE__, __LINE__, __FUNCTION__);
509
482
return false ;
510
483
}
511
484
auto expectedActorIdTy =
512
485
getDistributedActorSystemActorIDRequirementType (systemNominal);
513
486
actorIdReq.dump ();
514
487
if (!actorIdReq.getSecondType ()->isEqual (expectedActorIdTy)) {
515
- fprintf (stderr, " [%s:%d] (%s) if (!actorIdReq.getSecondType()->isEqual(expectedActorIdTy)) {\n " , __FILE__, __LINE__, __FUNCTION__);
516
488
return false ;
517
489
}
518
490
519
- fprintf (stderr, " [%s:%d] (%s) OKEY!!!! %s.%s\n " , __FILE__, __LINE__, __FUNCTION__, decl->getNameStr ().str ().c_str (), getNameStr ().str ().c_str ());
520
491
return true ;
521
492
}
522
493
0 commit comments