Preserve can_be_true and can_be_false when copying types (#7991)
This pull request modifies the `last_known_value` eraser so it
always copies over the previously inferred value of the
`can_be_true` and `can_be_false` fields.
This isn't entirely typesafe -- for example, we can sometimes
accidentally infer the wrong result if we try reassigning variables
or call a mutating function :
```
def bad1(a: List[str], b: bool) -> bool:
x = a and b
a = ["foo"]
y: bool
return x or y # Should be an error
def bad2(a: List[str], b: bool) -> bool:
x = a and b
a.append("foo")
y: bool
return x or y # Should be an error
```
But this was apparently the old behavior/something mypy wasn't
previously able to detect, so I guess this is fine for now.
I also decided against modifying every `copy_modified` method in
all the type classes because of this reason: I wanted to limit
the spread of this potentially misleading additional inferred info.
Fixes https://github.com/python/mypy/issues/7986, probably.