Coding 2023-05-07

By Max Woerner Chase

Okay. I've got tests for the saltate plugin. They're not passing yet, because I haven't nailed down the desired behavior. In order to get a proper idea of the desired behavior, I'm coming up with failing test cases, and inspecting the resulting failure messages.

Careful inspection of the error messages and the coverage data has allowed me to conclude...

That I still don't understand how Mypy represents types.

Anyway, I ended up reimplementing parts of the attrs plugin. At the rate this is going, I might accidentally make the plugin compatible with older versions of Mypy. I did the reimplementation because I was pulling out helper functions from the attrs plugin, and they really didn't expect to be used with anything that wasn't evolve. I'm still pulling out helper functions, just, less so.

Let's take a look at the improvements I want to make:

I don't know if the first one is possible. I believe I handled the second one, because the attrs plugin code is flexible, and I just needed to change which arguments I'm passing.

I worry that the second one will result in more deep-dives into the Mypy source code, because I have to somehow go from "a function call context" to "the context of an argument to that function". That sounds like something that someone would have needed at some point, but I really don't know, and I don't know what it would take to hack it together if people have gotten by without that somehow. Hm. I'm going to try retrieving the expression node from the function argument context, and...

There. We. Go.

I've got a few more tweaks I want to make to presentation, then I can get to work making tests of the updated parts of the plugin pass.

(I should maybe make sure that the positive tests pass, now that the negative tests are somewhat locked down...) Anyway, it's late, I should wrap up.

Good night.