@@ -7131,11 +7131,50 @@ RawFunction* Function::InstantiateSignatureFrom(
7131
7131
7132
7132
Function& sig = Function::Handle(Function::NewSignatureFunction(
7133
7133
owner, parent, TokenPosition::kNoSource, space));
7134
+ AbstractType& type = AbstractType::Handle(zone);
7135
+
7136
+ // Copy the type parameters and instantiate their bounds (if necessary).
7134
7137
if (!delete_type_parameters) {
7135
- sig.set_type_parameters(TypeArguments::Handle(zone, type_parameters()));
7138
+ const TypeArguments& type_params =
7139
+ TypeArguments::Handle(zone, type_parameters());
7140
+ if (!type_params.IsNull()) {
7141
+ TypeArguments& instantiated_type_params = TypeArguments::Handle(zone);
7142
+ TypeParameter& type_param = TypeParameter::Handle(zone);
7143
+ Class& cls = Class::Handle(zone);
7144
+ String& param_name = String::Handle(zone);
7145
+ for (intptr_t i = 0; i < type_params.Length(); ++i) {
7146
+ type_param ^= type_params.TypeAt(i);
7147
+ type = type_param.bound();
7148
+ if (!type.IsInstantiated(kAny, num_free_fun_type_params)) {
7149
+ type = type.InstantiateFrom(
7150
+ instantiator_type_arguments, function_type_arguments,
7151
+ num_free_fun_type_params, NULL, NULL, NULL, space);
7152
+ cls = type_param.parameterized_class();
7153
+ param_name = type_param.name();
7154
+ ASSERT(type_param.IsFinalized());
7155
+ type_param ^=
7156
+ TypeParameter::New(cls, sig, type_param.index(), param_name, type,
7157
+ type_param.token_pos());
7158
+ type_param.SetIsFinalized();
7159
+ if (instantiated_type_params.IsNull()) {
7160
+ instantiated_type_params = TypeArguments::New(type_params.Length());
7161
+ for (intptr_t j = 0; j < i; ++j) {
7162
+ type = type_params.TypeAt(j);
7163
+ instantiated_type_params.SetTypeAt(j, type);
7164
+ }
7165
+ }
7166
+ instantiated_type_params.SetTypeAt(i, type_param);
7167
+ } else if (!instantiated_type_params.IsNull()) {
7168
+ instantiated_type_params.SetTypeAt(i, type_param);
7169
+ }
7170
+ }
7171
+ sig.set_type_parameters(instantiated_type_params.IsNull()
7172
+ ? type_params
7173
+ : instantiated_type_params);
7174
+ }
7136
7175
}
7137
7176
7138
- AbstractType& type = AbstractType::Handle(zone, result_type() );
7177
+ type = result_type();
7139
7178
if (!type.IsInstantiated(kAny, num_free_fun_type_params)) {
7140
7179
type = type.InstantiateFrom(
7141
7180
instantiator_type_arguments, function_type_arguments,
@@ -7888,6 +7927,15 @@ bool Function::HasInstantiatedSignature(Genericity genericity,
7888
7927
return false;
7889
7928
}
7890
7929
}
7930
+ TypeArguments& type_params = TypeArguments::Handle(type_parameters());
7931
+ TypeParameter& type_param = TypeParameter::Handle();
7932
+ for (intptr_t i = 0; i < type_params.Length(); ++i) {
7933
+ type_param ^= type_params.TypeAt(i);
7934
+ type = type_param.bound();
7935
+ if (!type.IsInstantiated(genericity, num_free_fun_type_params, trail)) {
7936
+ return false;
7937
+ }
7938
+ }
7891
7939
return true;
7892
7940
}
7893
7941
0 commit comments