Skip to content

Literals.rst: change protocols location #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions docs/Literals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ The StringLiteralConvertible Protocol
-------------------------------------

Here is the StringLiteralConvertible protocol as defined in the standard
library's Policy.swift::
library's CompilerProtocols.swift::

// NOTE: the compiler has builtin knowledge of this protocol
protocol StringLiteralConvertible {
// Conforming types can be initialized with arbitrary string literals.
public protocol StringLiteralConvertible
: ExtendedGraphemeClusterLiteralConvertible {

typealias StringLiteralType : _BuiltinStringLiteralConvertible
class func convertFromStringLiteral(value : StringLiteralType) -> Self
// Create an instance initialized to `value`.
init(stringLiteral value: StringLiteralType)
}

Curiously, the protocol is not defined in terms of primitive types, but in
Expand All @@ -58,13 +62,16 @@ points could be constructed...which may be what's desired in some cases.)
The _BuiltinStringLiteralConvertible Protocol
---------------------------------------------

Policy.swift contains a second protocol::
CompilerProtocols.swift contains a second protocol::

// NOTE: the compiler has builtin knowledge of this protocol
protocol _BuiltinStringLiteralConvertible {
class func _convertFromBuiltinStringLiteral(value : Builtin.RawPointer,
byteSize : Builtin.Int64,
isASCII: Builtin.Int1) -> Self
public protocol _BuiltinStringLiteralConvertible
: _BuiltinExtendedGraphemeClusterLiteralConvertible {

init(
_builtinStringLiteral start: Builtin.RawPointer,
byteSize: Builtin.Word,
isASCII: Builtin.Int1)
}

The use of builtin types makes it clear that this is *only* for use in the
Expand Down