-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy path00131-swift-lexer-lexnumber.swift
132 lines (131 loc) · 2.03 KB
/
00131-swift-lexer-lexnumber.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// RUN: not %target-swift-frontend %s -typecheck
({})
func f() {
({})
}
class a {
typealias b = b
}
class A: A {
}
class B : C {
}
typealias C = B
func a<T>() {
enum b {
case c
}
}
protocol A {
typealias E
}
struct B<T : A> {
let h: T
let i: T.E
}
protocol C {
typealias F
func g<T where T.E == F>(f: B<T>)
}
struct D : C {
typealias F = Int
func g<T where T.E == F>(f: B<T>) {
}
}
protocol b {
class func e()
}
struct c {
var d: b.Type
func e() {
d.e()
}
}
func c<d {
enum c {
func e
var _ = e
}
}
protocol A {
typealias B
}
class C<D> {
init <A: A where A.B == D>(e: A.B) {
c {
func b((Any, c))(a: (Any, AnyObject)) {
b(a)
}
}
protocol A {
}
struct B : A {
}
struct C<D, E: A where D.C == E> {
}
protocol a {
class func c()
}
class b: a {
class func c() { }
}
(b() as a).dynamicType.c()
struct A<T> {
let a: [(T, () -> ())] = []
}
func a<T>() -> (T, T -> T) -> T {
var b: ((T, T -> T) -> T)!
return b
}
class A<T : A> {
}
struct c<d : Sequence> {
var b: d
}
func a<d>() -> [c<d>] {
return []
}
f
e)
func f<g>() -> (g, g -> g) -> g {
d j d.i = {
}
{
g) {
h }
}
protocol f {
class func i()
}
class d: f{ class func i {}
func i(c: () -> ()) {
}
class a {
var _ = i() {
}
}
import Foundation
class Foo<T>: NSObject {
var foo: T
init(foo: T) {
self.foo = foo
super.init()
}
}
func some<S: Sequence, T where Optional<T> == S.Iterator.Element>(xs : S) -> T? {
for (mx : T?) in xs {
if let x = mx {
return x
}
}
return nil
}
let xs : [Int?] = [nil, 4, nil]
print(some(xs))
a=1 as a=1