diff --git a/lib/Sema/CSApply.cpp b/lib/Sema/CSApply.cpp index c4baa20e0ca..ce62c8706a7 100644 --- a/lib/Sema/CSApply.cpp +++ b/lib/Sema/CSApply.cpp @@ -5399,7 +5399,8 @@ Expr *ExprRewriter::coerceCallArguments(Expr *arg, AnyFunctionType *funcType, // Otherwise, create a call of the default argument generator. } else { - const ParamDecl *defaultParam = getParameterAt(cast(callee.getDecl()), newArgs.size()); + const ParamDecl *defaultParam = getParameterAt(callee.getDecl(), + newArgs.size()); defArg = defaultParam->getDefaultValue(); if (defArg == nullptr) { diff --git a/test/SILGen/keypaths.swift b/test/SILGen/keypaths.swift index bea888ba744..2c4cf966dce 100644 --- a/test/SILGen/keypaths.swift +++ b/test/SILGen/keypaths.swift @@ -397,7 +397,10 @@ func subscripts(x: T, y: U, s: String) { _ = \SubscriptDefaults1.[bool: false, 0, 0] _ = \SubscriptDefaults2.[] + _ = \SubscriptDefaults2.[0] + _ = \SubscriptDefaults3.[] + _ = \SubscriptDefaults3.[0] } // CHECK-LABEL: sil hidden [ossa] @{{.*}}subclass_generics