bors[bot] 67351a011b
Merge #3805
3805: lower literal patterns r=JoshMcguigan a=JoshMcguigan

While working on #3706 I discovered literal patterns weren't being lowered. This PR implements that lowering.

Questions for reviewers:

1. This re-uses the existing conversion from `ast::LiteralKind` to `Literal`, but `ast::LiteralKind` doesn't include information about the actual value of the literal, which causes `Literal` to be created with the default value for the type (rather than the actual value in the source code). Am I correct in thinking that we'd eventually want to change things in such a way that we could initialize the `Literal` with the actual literal value? Is there an existing issue for this, or else perhaps I should create one to discuss how it should be implemented? My main question would be whether `ast::LiteralKind` should be extended to hold the actual value, or if we should provide some other way to get that information from `ast::Literal`?
2. I couldn't find tests which directly cover this, but it does seem to work in #3706. Do we have unit tests for this lowering code?
3. I'm not sure why `lit.literal()` returns an `Option`. Is returning a `Pat::Missing` in the `None` case the right thing to do? 
4. I was basically practicing type-system driven development to figure out the transformation from `ast::Pat::LiteralPat` to `Pat::Lit`. I don't have an immediate question here, but I just wanted to ensure this section is looked at closely during review. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-01 11:22:31 +00:00
..
2020-03-31 09:02:12 -04:00
2020-02-18 16:12:40 +02:00
2020-03-26 17:09:32 +00:00
2020-04-01 13:14:38 +02:00
2020-03-23 16:22:46 -07:00
2020-03-25 19:35:46 +01:00
2020-04-01 04:18:46 -07:00
2020-03-31 19:00:23 +03:00
2020-04-01 10:41:46 +00:00
2020-03-27 00:46:40 +08:00
2020-03-31 22:20:19 +08:00
2020-03-30 11:33:01 +02:00
2020-03-31 19:29:11 +02:00
2020-03-31 12:53:51 +00:00
2020-04-01 13:14:38 +02:00
2020-03-30 18:51:30 +02:00
2020-03-13 12:20:42 +01:00