| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/general/issue44654.dart:7:7: Error: A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. |
| // if (string?.isNotEmpty) ; |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| static method test2() → void { |
| has-declared-initializer core::String? string = null; |
| if(invalid-expression "pkg/front_end/testcases/general/issue44654.dart:7:7: Error: A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't. |
| if (string?.isNotEmpty) ; |
| ^" in let core::bool? #t1 = let final core::String? #t2 = string in #t2 == null ?{core::bool?} null : #t2{core::String}.{core::String::isNotEmpty}{core::bool} in #t1 == null ?{core::bool} #t1 as{TypeError} core::bool : #t1{core::bool}) |
| ; |
| } |
| static method main() → void { |
| try { |
| self::test2(); |
| } |
| on core::Object catch(final core::Object e, final core::StackTrace s) { |
| self::checkFirstLineHasPosition(s); |
| } |
| } |
| static method checkFirstLineHasPosition(core::StackTrace stackTrace) → void { |
| core::String firstLine = "${stackTrace}".{core::String::split}(" |
| "){(core::Pattern) → core::List<core::String>}.{core::Iterable::firstWhere}((core::String line) → core::bool => line.{core::String::startsWith}("#0"){(core::Pattern, [core::int]) → core::bool}){((core::String) → core::bool, {orElse: () →? core::String}) → core::String}; |
| core::int lastParen = firstLine.{core::String::lastIndexOf}(")"){(core::Pattern, [core::int?]) → core::int}; |
| if(!(lastParen =={core::num::==}{(core::Object) → core::bool} 1.{core::int::unary-}(){() → core::int})) { |
| core::int secondColon = firstLine.{core::String::lastIndexOf}(":", lastParen.{core::num::-}(1){(core::num) → core::int}){(core::Pattern, [core::int?]) → core::int}; |
| if(!(secondColon =={core::num::==}{(core::Object) → core::bool} 1.{core::int::unary-}(){() → core::int})) { |
| core::int firstColon = firstLine.{core::String::lastIndexOf}(":", secondColon.{core::num::-}(1){(core::num) → core::int}){(core::Pattern, [core::int?]) → core::int}; |
| core::String lineText = firstLine.{core::String::substring}(firstColon.{core::num::+}(1){(core::num) → core::int}, secondColon){(core::int, [core::int?]) → core::String}; |
| core::String posText = firstLine.{core::String::substring}(secondColon.{core::num::+}(1){(core::num) → core::int}, lastParen){(core::int, [core::int?]) → core::String}; |
| core::int? line = core::int::tryParse(lineText); |
| core::int? pos = core::int::tryParse(posText); |
| if(!(line == null) && !(pos == null)) { |
| core::print("Found position ${line{core::int}}:${pos{core::int}}"); |
| return; |
| } |
| } |
| } |
| throw "No position found in \"${firstLine}\""; |
| } |
| |
| |
| Extra constant evaluation status: |
| Evaluated: InstanceInvocation @ org-dartlang-testcase:///issue44654.dart:23:20 -> IntConstant(-1) |
| Evaluated: InstanceInvocation @ org-dartlang-testcase:///issue44654.dart:25:24 -> IntConstant(-1) |
| Extra constant evaluation: evaluated: 56, effectively constant: 2 |