Last active
May 13, 2019 15:23
-
-
Save passsy/bab95e3320cb9abbbb08282210c07ca4 to your computer and use it in GitHub Desktop.
Missing compile time check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Apple {} | |
class Banana {} | |
List<Apple> bag([List<Apple> apples]) => apples ?? <Banana>[]; | |
void main() { | |
// ok | |
final bag1 = bag([Apple()]); | |
print(bag1); | |
// throws runtime error, should be compile time error | |
final bag2 = bag(); | |
print(bag2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment