Commits

Doug Gregor committed ac20b61d673
Migrate floating-point literals over to a formal protocol. Introduce the FloatLiteralConvertible and BuiltinFloatLiteralConvertible protocols, which together describe the formal protocol for floating-point literals. User types can conform to FloatLiteralConvertible, which requires that the convertFromFloatLiteral() argument be some type that conforms to BuiltinFloatLiteralConvertible. Only standard library types can conform to BuiltinFloatLiteralConvertible, because it requires the argument type of _convertFromBuiltinFloatLiteral() to be a builtin floating-point type. This two-protocol solution is necessary to model the two levels of conversions that we permit (without allowing arbitrary conversion). Note that the standard library floating-point types conform to both protocols, which is important because generic algorithms may choose to constraint their types based on FloatLiteralConvertible. It's now possible to use floating-point literals in generics with FloatLiteralConvertible-constrained archetypes, at least when the solver doesn't do something silly. The handling of the FloatLiteralConvertible requirement within the type checker is still a little strange, because (1) we don't have a conforms-to requirement kind, which means we have to use conversion, and (2) the solver has a nasty habit of choosing existential types when it sees such conversion requirements. As a drive-by fix, give the conversion constraints for the elements in array and dictionary literals a proper locator, so that we can properly handle user-defined conversions within those arguments. Swift SVN r5415