From 9447db144ec796673cd4aecbf0f89fa9c724e652 Mon Sep 17 00:00:00 2001 From: "floitsch@google.com" Date: Wed, 3 Jul 2013 15:06:50 +0000 Subject: [PATCH] Make cyclic error init more complicated to avoid static warnings. Review URL: https://codereview.chromium.org//18433003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24728 260f80e4-7a28-3924-810f-c04153c831b5 --- tests/corelib/error_stack_trace2_test.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/corelib/error_stack_trace2_test.dart b/tests/corelib/error_stack_trace2_test.dart index 19589755c39..c9a80a82ba6 100644 --- a/tests/corelib/error_stack_trace2_test.dart +++ b/tests/corelib/error_stack_trace2_test.dart @@ -4,7 +4,12 @@ import "package:expect/expect.dart"; -var cyclicStatic = cyclicStatic + 1; +class A { + get foo => cyclicStatic; +} + +var a = new A(); +var cyclicStatic = (() => a.foo + 1)(); cyclicInitialization() { return cyclicStatic; @@ -14,7 +19,9 @@ main() { bool hasThrown = false; try { cyclicStatic + 1; - } catch(e) { + } catch(e2) { + // Work around bug in analyzer that assigns "Object" type to caught error. + var e = e2; hasThrown = true; Expect.isTrue(e.stackTrace is StackTrace, "$e doesn't have a non-null stack trace");