@@ -359,16 +359,6 @@ bool TypeResolution::areSameType(Type type1, Type type2) const {
359
359
return areSameType (depMem1->getBase (), depMem2->getBase ());
360
360
}
361
361
362
- Type TypeChecker::getArraySliceType (SourceLoc loc, Type elementType) {
363
- ASTContext &ctx = elementType->getASTContext ();
364
- if (!ctx.getArrayDecl ()) {
365
- ctx.Diags .diagnose (loc, diag::sugar_type_not_found, 0 );
366
- return ErrorType::get (ctx);
367
- }
368
-
369
- return ArraySliceType::get (elementType);
370
- }
371
-
372
362
Type TypeChecker::getOptionalType (SourceLoc loc, Type elementType) {
373
363
ASTContext &ctx = elementType->getASTContext ();
374
364
if (!ctx.getOptionalDecl ()) {
@@ -3604,12 +3594,17 @@ NeverNullType TypeResolver::resolveArrayType(ArrayTypeRepr *repr,
3604
3594
return ErrorType::get (getASTContext ());
3605
3595
}
3606
3596
3607
- auto sliceTy =
3608
- TypeChecker::getArraySliceType (repr->getBrackets ().Start , baseTy);
3609
- if (sliceTy->hasError ())
3610
- return ErrorType::get (getASTContext ());
3597
+ ASTContext &ctx = baseTy->getASTContext ();
3598
+ // If the standard library isn't loaded, we ought to let the user know
3599
+ // something has gone terribly wrong, since the rest of the compiler is going
3600
+ // to assume it can canonicalize [T] to Array<T>.
3601
+ if (!ctx.getArrayDecl ()) {
3602
+ ctx.Diags .diagnose (repr->getBrackets ().Start ,
3603
+ diag::sugar_type_not_found, 0 );
3604
+ return ErrorType::get (ctx);
3605
+ }
3611
3606
3612
- return sliceTy ;
3607
+ return ArraySliceType::get (baseTy) ;
3613
3608
}
3614
3609
3615
3610
NeverNullType
0 commit comments