-
Notifications
You must be signed in to change notification settings - Fork 55
fixes #15, strong mode errors #16
Conversation
CC @nex3 @devoncarew by the way, this doesn't address warning (many of which would cause runtime failures due to invalid generic casts) -- working on that in a follow up |
I went ahead and fixed warnings too. Note that the |
This makes the code a lot harder to read—the point of those closures was to make "A then maybe B or B then maybe A" read as clearly as that sentence, and adding extra boilerplate hurts that. It's also not clear as a user that these particular assignments would causing problems, or why. Is this something that will be fixed eventually? Is there a bug filed? Should there be?
I'd like to hold off on adding workarounds for bogus warnings that will be fixed. |
No, I don't think this one is fixable. The method is too complex for type promotion to work well there (indeed, it didn't work before-- I'm happy to try another way of refactoring that method. A few options that came to mind:
Let me know which one you prefer.
that's why I CC'd @devoncarew. I think he needs this much sooner than we will have a fix for that. Sometimes it takes a small step back to take a bigger step forward :). Happy to come back and fix this code once we have a fix for that one. |
Oh, another idea: we can mark |
Can we just declare
Why do we need code to be DDC-warning-clean? That seems premature when there are still so many issues with the inference, and particularly when there's no way to write generic methods. |
In this case, we want to use DDC for the Dart plugin for Atom. The Dart plugin for Atom needs to read YAML files. |
DDC can compile without being warning-clean, right? |
I'd love a way to know which ddc warnings will impact me in different ways. Like:
The last item might be more important for some packages, less for others, and would be things that I'd probably work on slowly over time. |
That's exactly what inference is concluding. You'll get the same errors. The problem with that method is it's assigning to (If Dart had pattern matching or something, instead of type promotion, we'd be in a much better place for code like that. But syntax would be different, so that would be an even bigger change to the method.) |
@nex3 I don't see any issue in @jmesserly 's patch here that will be improved in DDC other than @devoncarew Errors are most serious. If you --force-compile, we'll generate code anyway and it might work, but bugs will be harder to catch. Warnings don't stop us from compiling - and if there really is a problem, we should throw a meaningful error at runtime - we'll generating a runtime check. Prettiness of output is useful due to dynamic operations - those are reported as just info right now. |
Yeah, I'm happy to use |
I switched to |
@@ -89,7 +89,7 @@ YamlList loadYamlStream(String yaml, {sourceUrl}) { | |||
} | |||
|
|||
return new YamlList.internal( | |||
documents.map((document) => document.contents).toList(), | |||
documents.map((YamlDocument document) => document.contents).toList(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a TODO to get rid of this.
I'd still like a better understanding of why the |
@nex3 If you explicitly type it as
|
Okay, so as I understand it: the issue is that the closure means that DDC can't prove that @jmesserly I have an alternate idea for getting rid of these warnings. If you remove the |
yeah, there's lots of possibilities. Go for it. I can rebase after your change lands. |
just to be clear, it's not coming from DDC. This is the Dart language spec & existing Dart Analyzer. |
Okay, but the existing language spec never produces warnings here anyway. |
yeah, that's a side effect of local type inference, which seems pretty non-controversial on its own. It can definitely introduce new errors, but only because previously Dart was suppressing all checks on |
edit: I meant, "not controversial" ;) |
Don't get me wrong, I'm definitely in favor of local type inference. |
fb4313d fixes the parser warning. |
PTAL, rebased against master, dropped |
👍 Can you bump the pubspec to a stable version before you merge? |
Done, PTAL |
Thanks Natalie! |
fixes dart-lang/yaml#15, strong mode errors
most of it was refactoring to avoid an assignment in a closure, which disabled type promotion