Summary: | Problems when reassigning a built-in name | ||
---|---|---|---|
Product: | [Developer tools] kdev-python | Reporter: | Eike Hein <hein> |
Component: | general | Assignee: | Sven Brauch <mail> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | |
Priority: | NOR | ||
Version: | git master | ||
Target Milestone: | 1.2.0 | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Eike Hein
2011-06-20 03:01:20 UTC
Hmm, the problem is that a Declaration apparently cannot have a type like unsure (some_function, int), which would mix function and integral types in a single unsure type. I'll look into it. If you first define a function, the re-assign it with another value (like, 3) then an error should be reported now (this is due to technical reasons, and also because you usually don't want to do it). Do you think that's okay? Also I'm not quite sure it works correctly, it seems to be doing strange things sometimes. Bye, Sven Hm to be honest, no, I don't, although I recognize there will be different opinions about this, so there's no real "right" :). IMHO Python's builtins namespace is pretty large and contains a fair amount of names that are simply too useful in general code to fully avoid - like "all", for example. I think there's real value to an IDE *warning* me about overriding a builtin in case I do it accidentally, but reporting it as an error by default feels a bit too harsh to me personally. The real code I noticed the issue in deliberately used "all" for example. By the way, even with the latest changes the behavior is a bit weird ... all three lines now get the "Problem in Semantic Analysis" tooltip, but the last two "all"s are still highlighted together when any of the two is hovered, while the first stands alone. Yeah, I noticed it still doesn't work. I also agree, after thinking about it, that this solution is not really acceptable. I'll try to find something better. Okay, maybe it works like this now? :) Getting closer :-). This works fine now: all = 1 all = 2 all = 3 All of those now get highlighted together when any of them is hovered and the same tooltip is shown for all of them. It's saying the var is float, which is a bit odd, since really the name is being assigned to an integer literal, but I've seen that before, so it's an unrelated bug I guess (is it a bug or intentional, actually?). However ... when I just have this in the file: all ... and hover it, the tooltip says "Invalid type" and "Kind: Function". Why "Invalid type"? :) As you suggested on IRC, wiping ~/.kdevduchain fixed the "Invalid type" thing :-). Aside from integer literals being taken for floats, which is a separate issue anyway, looks like this is fixed now. Thanks! Okay, fine. Integers <> Floats just isn't implemented yet, as I'll have to do this manually (i.e. python just tells you "number"). It's on my to-do-list. :) |