Files
carbon-lang/explorer/testdata/template/instantiations_are_cached.carbon
T
Geoff Romer f747cb0c93 Add cache of template instantiations. (#3243)
Also some drive-by comment and trace improvements.

Closes #2951
2023-09-19 20:32:48 +00:00

33 lines
690 B
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
package ExplorerTest api;
interface I { fn F(); }
impl () as I {
fn F() {}
}
impl forall [template T:! type] (T,) as I {
fn F() {
if (true) {
T.(I.F)();
} else {
T.(I.F)();
}
}
}
fn Main() -> i32 {
// This would cause an exponential number of template instantiations if we
// didn't cache them.
((((((((((((((((((((((((((((((((),),),),),),),),),),),),),),),),),),),),),),),),),),),),),),)).(I.F)();
return 0;
}
// CHECK:STDOUT: result: 0