Simplify some optional return code
40bf87cb9bd630336fcb32e87ace4447360d789ad99d629865e218890a9993e1
1 parent
ff5b37ff
lib/std/lang/resolver.rad
+3 -12
| 1689 | 1689 | return Coercion::Identity; |
|
| 1690 | 1690 | } |
|
| 1691 | 1691 | return nil; |
|
| 1692 | 1692 | } |
|
| 1693 | 1693 | case ast::NodeValue::ArrayRepeatLit(repeat) => { |
|
| 1694 | - | if let coerce = isAssignable(self, *lhs.item, *rhs.item, repeat.item) { |
|
| 1695 | - | return coerce; |
|
| 1696 | - | } |
|
| 1697 | - | return nil; |
|
| 1694 | + | return isAssignable(self, *lhs.item, *rhs.item, repeat.item); |
|
| 1698 | 1695 | } |
|
| 1699 | 1696 | else => { |
|
| 1700 | 1697 | // For non-literal arrays, require exact element type match. |
|
| 1701 | 1698 | if lhs.item == rhs.item { |
|
| 1702 | 1699 | return Coercion::Identity; |
| 1722 | 1719 | return Coercion::Identity; |
|
| 1723 | 1720 | } |
|
| 1724 | 1721 | if lhsMutable and not rhsMutable { |
|
| 1725 | 1722 | return nil; |
|
| 1726 | 1723 | } |
|
| 1727 | - | if let coerce = isAssignable(self, *lhsTarget, *rhsTarget, rval) { |
|
| 1728 | - | return coerce; |
|
| 1729 | - | } |
|
| 1730 | - | return nil; |
|
| 1724 | + | return isAssignable(self, *lhsTarget, *rhsTarget, rval); |
|
| 1731 | 1725 | } |
|
| 1732 | 1726 | case Type::Optional(inner) => { |
|
| 1733 | 1727 | if from == Type::Nil { |
|
| 1734 | 1728 | return Coercion::OptionalLift(to); |
|
| 1735 | 1729 | } |
| 1772 | 1766 | } |
|
| 1773 | 1767 | // Allow coercion from `*[T]` to `*[opaque]`, and `*mut [T]` to `*mut [opaque]`. |
|
| 1774 | 1768 | if *lhsItem == Type::Opaque { |
|
| 1775 | 1769 | return Coercion::Identity; |
|
| 1776 | 1770 | } |
|
| 1777 | - | if let coerce = isAssignable(self, *lhsItem, *rhsItem, rval) { |
|
| 1778 | - | return coerce; |
|
| 1779 | - | } |
|
| 1780 | - | return nil; |
|
| 1771 | + | return isAssignable(self, *lhsItem, *rhsItem, rval); |
|
| 1781 | 1772 | } |
|
| 1782 | 1773 | else => return nil, |
|
| 1783 | 1774 | } |
|
| 1784 | 1775 | } |
|
| 1785 | 1776 | case Type::Fn(toInfo) => { |