Skip to content

Conversation

@aschwaighofer
Copy link
Contributor

…nbound Objective-C generic for bound ones

IRGen does so. So don't assert on this case.

rdar://63509292

…nbound Objective-C generic for bound ones

IRGen does so. So don't assert on this case.

rdar://63509292
@aschwaighofer aschwaighofer requested a review from jckarter May 26, 2020 20:28
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@slavapestov
Copy link
Contributor

IRGen's behavior has caused problems in the past. I think it's a bit of a hack. This fix is totally fine but it would be nice if we could wean IRGen off of UnboundGenericTypes entirely. They should not exist after type checking.

@aschwaighofer
Copy link
Contributor Author

IRGen creates it here:

// Get the type that exists at runtime to represent a compile-time type.        
CanType IRGenModule::getRuntimeReifiedType(CanType type) {                      
  // Leave type-erased ObjC generics with their generic arguments unbound, since
  // the arguments do not exist at runtime.                                     
  return CanType(type.transform([&](Type t) -> Type {                           
    if (CanType(t).isTypeErasedGenericClassType()) {                            
      return t->getAnyNominal()->getDeclaredType()->getCanonicalType();         
    }                                                                           
    return t;                                                                   
  }));                                                                          
}  

@slavapestov
Copy link
Contributor

Yeah, it seems like whoever consumes the result of that is unable to handle a BoundGenericType whose decl is an Objective-C generic class. It seems like it would be easier to fix that code to instead ignore the generic arguments there, rather than performing this transformation in the right place.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@jckarter
Copy link
Contributor

@slavapestov Part of the issue is that we (at least historically) rely on the type identity being the same for types that are equivalent at runtime in parts of IRGen. There's likely to be better ways to do that, though.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 532f0cb

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test linux

@aschwaighofer aschwaighofer merged commit b148e24 into swiftlang:master May 28, 2020
aschwaighofer added a commit to aschwaighofer/swift that referenced this pull request Jul 30, 2020
…nbound Objective-C generic for bound ones (take 2)

IRGen does so. So don't assert on the case when there is a nested
Objective-C type.

(follow-up to swiftlang#32027 rdar://63509292 which fixed the non-nested case)

rdar://66302139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants