forked from sorbet/sorbet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SymbolRef.h
1043 lines (810 loc) · 28.3 KB
/
SymbolRef.h
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#ifndef RUBY_TYPER_SYMBOLREF_H
#define RUBY_TYPER_SYMBOLREF_H
#include "common/common.h"
#include "core/DebugOnlyCheck.h"
#include "core/ShowOptions.h"
namespace sorbet::core {
class Symbol;
class GlobalState;
class NameRef;
class Loc;
class TypePtr;
struct SymbolDataDebugCheck {
const GlobalState &gs;
const unsigned int symbolCountAtCreation;
SymbolDataDebugCheck(const GlobalState &gs);
void check() const;
};
/** These classes are intended to be a safe way to pass symbol references around.
* Entering new symbols can invalidate `Symbol &`s and thus they are generally unsafe.
* This class ensures that all accesses are safe in debug builds and effectively is a `Symbol &` in optimized builds.
*/
class SymbolData : private DebugOnlyCheck<SymbolDataDebugCheck> {
Symbol &symbol;
public:
SymbolData(Symbol &ref, GlobalState &gs);
Symbol *operator->();
const Symbol *operator->() const;
};
CheckSize(SymbolData, 8, 8);
class ConstSymbolData : private DebugOnlyCheck<SymbolDataDebugCheck> {
const Symbol &symbol;
public:
ConstSymbolData(const Symbol &ref, const GlobalState &gs);
const Symbol *operator->() const;
};
CheckSize(ConstSymbolData, 8, 8);
class Method;
class MethodData : private DebugOnlyCheck<SymbolDataDebugCheck> {
Method &method;
public:
MethodData(Method &ref, GlobalState &gs);
Method *operator->();
const Method *operator->() const;
};
CheckSize(MethodData, 8, 8);
class ConstMethodData : private DebugOnlyCheck<SymbolDataDebugCheck> {
const Method &method;
public:
ConstMethodData(const Method &ref, const GlobalState &gs);
const Method *operator->() const;
};
CheckSize(ConstMethodData, 8, 8);
class Field;
class FieldData : private DebugOnlyCheck<SymbolDataDebugCheck> {
Field &field;
public:
FieldData(Field &ref, GlobalState &gs);
Field *operator->();
const Field *operator->() const;
};
CheckSize(FieldData, 8, 8);
class ConstFieldData : private DebugOnlyCheck<SymbolDataDebugCheck> {
const Field &field;
public:
ConstFieldData(const Field &ref, const GlobalState &gs);
const Field *operator->() const;
};
CheckSize(ConstFieldData, 8, 8);
class ClassOrModuleRef final {
uint32_t _id;
friend class SymbolRef;
friend class GlobalState;
private:
std::string toStringWithOptions(const GlobalState &gs, int tabs = 0, bool showFull = false,
bool showRaw = false) const;
public:
ClassOrModuleRef() : _id(0){};
ClassOrModuleRef(const GlobalState &from, uint32_t id);
uint32_t id() const {
return _id;
}
bool exists() const {
return _id != 0;
}
static ClassOrModuleRef fromRaw(uint32_t id) {
ClassOrModuleRef ref;
ref._id = id;
return ref;
}
SymbolData data(GlobalState &gs) const;
SymbolData dataAllowingNone(GlobalState &gs) const;
ConstSymbolData data(const GlobalState &gs) const;
ConstSymbolData dataAllowingNone(const GlobalState &gs) const;
bool operator==(const ClassOrModuleRef &rhs) const;
bool operator!=(const ClassOrModuleRef &rhs) const;
std::string toString(const GlobalState &gs) const {
bool showFull = false;
bool showRaw = false;
return toStringWithOptions(gs, 0, showFull, showRaw);
}
std::string_view showKind(const GlobalState &gs) const;
std::string showFullName(const GlobalState &gs) const;
std::string toStringFullName(const GlobalState &gs) const;
std::string show(const GlobalState &gs) const {
return show(gs, {});
};
std::string show(const GlobalState &gs, ShowOptions options) const;
};
CheckSize(ClassOrModuleRef, 4, 4);
class MethodRef final {
uint32_t _id;
friend class SymbolRef;
private:
std::string toStringWithOptions(const GlobalState &gs, int tabs = 0, bool showFull = false,
bool showRaw = false) const;
public:
MethodRef() : _id(0){};
MethodRef(const GlobalState &from, uint32_t id);
uint32_t id() const {
return _id;
}
bool exists() const {
return _id != 0;
}
static MethodRef fromRaw(uint32_t id) {
MethodRef ref;
ref._id = id;
return ref;
}
std::string toString(const GlobalState &gs) const {
bool showFull = false;
bool showRaw = false;
return toStringWithOptions(gs, 0, showFull, showRaw);
}
MethodData data(GlobalState &gs) const;
ConstMethodData data(const GlobalState &gs) const;
MethodData dataAllowingNone(GlobalState &gs) const;
ClassOrModuleRef enclosingClass(const GlobalState &gs) const;
std::string_view showKind(const GlobalState &gs) const;
std::string showFullName(const GlobalState &gs) const;
std::string toStringFullName(const GlobalState &gs) const;
std::string show(const GlobalState &gs) const {
return show(gs, {});
};
std::string show(const GlobalState &gs, ShowOptions options) const;
bool operator==(const MethodRef &rhs) const;
bool operator!=(const MethodRef &rhs) const;
};
CheckSize(MethodRef, 4, 4);
class FieldRef final {
uint32_t _id;
friend class SymbolRef;
private:
std::string toStringWithOptions(const GlobalState &gs, int tabs = 0, bool showFull = false,
bool showRaw = false) const;
public:
FieldRef() : _id(0){};
FieldRef(const GlobalState &from, uint32_t id);
uint32_t id() const {
return _id;
}
bool exists() const {
return _id != 0;
}
static FieldRef fromRaw(uint32_t id) {
FieldRef ref;
ref._id = id;
return ref;
}
FieldData data(GlobalState &gs) const;
ConstFieldData data(const GlobalState &gs) const;
ConstFieldData dataAllowingNone(const GlobalState &gs) const;
FieldData dataAllowingNone(GlobalState &gs) const;
std::string_view showKind(const GlobalState &gs) const;
std::string showFullName(const GlobalState &gs) const;
std::string toStringFullName(const GlobalState &gs) const;
std::string show(const GlobalState &gs) const {
return show(gs, {});
};
std::string show(const GlobalState &gs, ShowOptions options) const;
bool operator==(const FieldRef &rhs) const;
bool operator!=(const FieldRef &rhs) const;
};
CheckSize(FieldRef, 4, 4);
class TypeMemberRef final {
uint32_t _id;
friend class SymbolRef;
private:
std::string toStringWithOptions(const GlobalState &gs, int tabs = 0, bool showFull = false,
bool showRaw = false) const;
public:
TypeMemberRef() : _id(0){};
TypeMemberRef(const GlobalState &from, uint32_t id);
uint32_t id() const {
return _id;
}
bool exists() const {
return _id != 0;
}
static TypeMemberRef fromRaw(uint32_t id) {
TypeMemberRef ref;
ref._id = id;
return ref;
}
SymbolData data(GlobalState &gs) const;
ConstSymbolData data(const GlobalState &gs) const;
SymbolData dataAllowingNone(GlobalState &gs) const;
std::string_view showKind(const GlobalState &gs) const;
std::string showFullName(const GlobalState &gs) const;
std::string toStringFullName(const GlobalState &gs) const;
std::string show(const GlobalState &gs) const {
return show(gs, {});
};
std::string show(const GlobalState &gs, ShowOptions options) const;
bool operator==(const TypeMemberRef &rhs) const;
bool operator!=(const TypeMemberRef &rhs) const;
};
CheckSize(TypeMemberRef, 4, 4);
class TypeArgumentRef final {
uint32_t _id;
friend class SymbolRef;
friend class MethodRef;
private:
std::string toStringWithOptions(const GlobalState &gs, int tabs = 0, bool showFull = false,
bool showRaw = false) const;
public:
TypeArgumentRef() : _id(0){};
TypeArgumentRef(const GlobalState &from, uint32_t id);
uint32_t id() const {
return _id;
}
bool exists() const {
return _id != 0;
}
static TypeArgumentRef fromRaw(uint32_t id) {
TypeArgumentRef ref;
ref._id = id;
return ref;
}
SymbolData data(GlobalState &gs) const;
ConstSymbolData data(const GlobalState &gs) const;
SymbolData dataAllowingNone(GlobalState &gs) const;
std::string_view showKind(const GlobalState &gs) const;
std::string showFullName(const GlobalState &gs) const;
std::string toStringFullName(const GlobalState &gs) const;
std::string show(const GlobalState &gs) const {
return show(gs, {});
};
std::string show(const GlobalState &gs, ShowOptions options) const;
bool operator==(const TypeArgumentRef &rhs) const;
bool operator!=(const TypeArgumentRef &rhs) const;
};
CheckSize(TypeArgumentRef, 4, 4);
class SymbolRef final {
friend class GlobalState;
friend class Symbol;
// For toStringWithOptions.
friend class ClassOrModuleRef;
friend class MethodRef;
// Stores the symbol's Kind and Index. Kind occupies the lower bits.
uint32_t _id;
uint32_t unsafeTableIndex() const {
return _id >> KIND_BITS;
}
private:
std::string toStringWithOptions(const GlobalState &gs, int tabs = 0, bool showFull = false,
bool showRaw = false) const;
public:
// If you add Symbol Kinds, make sure KIND_BITS is kept in sync!
enum class Kind : uint8_t {
ClassOrModule = 0,
Method = 1,
FieldOrStaticField = 2,
TypeArgument = 3,
TypeMember = 4,
};
// Kind takes up this many bits in _id.
static constexpr uint32_t KIND_BITS = 3;
static constexpr uint32_t ID_BITS = 32 - KIND_BITS;
static constexpr uint32_t KIND_MASK = (1 << KIND_BITS) - 1;
static constexpr uint32_t MAX_ID = (1 << ID_BITS) - 1;
Kind kind() const {
return static_cast<Kind>(_id & KIND_MASK);
}
uint32_t rawId() const {
return _id;
}
inline bool isClassOrModule() const {
return kind() == Kind::ClassOrModule;
}
inline bool isMethod() const {
return kind() == Kind::Method;
}
inline bool isFieldOrStaticField() const {
return kind() == Kind::FieldOrStaticField;
}
inline bool isTypeArgument() const {
return kind() == Kind::TypeArgument;
}
inline bool isTypeMember() const {
return kind() == Kind::TypeMember;
}
bool isTypeAlias(const GlobalState &gs) const;
bool isField(const GlobalState &gs) const;
bool isStaticField(const GlobalState &gs) const;
uint32_t classOrModuleIndex() const {
ENFORCE_NO_TIMER(kind() == Kind::ClassOrModule);
return unsafeTableIndex();
}
uint32_t methodIndex() const {
ENFORCE_NO_TIMER(kind() == Kind::Method);
return unsafeTableIndex();
}
uint32_t fieldIndex() const {
ENFORCE_NO_TIMER(kind() == Kind::FieldOrStaticField);
return unsafeTableIndex();
}
uint32_t typeArgumentIndex() const {
ENFORCE_NO_TIMER(kind() == Kind::TypeArgument);
return unsafeTableIndex();
}
uint32_t typeMemberIndex() const {
ENFORCE_NO_TIMER(kind() == Kind::TypeMember);
return unsafeTableIndex();
}
SymbolRef(GlobalState const *from, Kind type, uint32_t id);
SymbolRef(const GlobalState &from, Kind type, uint32_t id);
// This constructor is not marked explicit so that we can implicitly convert ClassOrModuleRef to SymbolRefs as
// method arguments. This conversion is always safe and never throws.
SymbolRef(ClassOrModuleRef kls);
SymbolRef(MethodRef kls);
SymbolRef(FieldRef kls);
SymbolRef(TypeMemberRef kls);
SymbolRef(TypeArgumentRef kls);
SymbolRef() : _id(0){};
// From experimentation, in the common case, methods typically have 2 or fewer arguments.
// Placed here so it can be used across packages for common case optimizations.
static constexpr int EXPECTED_METHOD_ARGS_COUNT = 2;
static SymbolRef fromRaw(uint32_t raw) {
auto ref = SymbolRef();
ref._id = raw;
return ref;
}
bool inline exists() const {
// 0th index is reserved on all symbol vectors for the non existant symbol.
return unsafeTableIndex() != 0;
}
bool isSynthetic() const;
// If Kind is ClassOrModule, returns a ClassOrModuleRef.
ClassOrModuleRef asClassOrModuleRef() const {
ENFORCE_NO_TIMER(kind() == Kind::ClassOrModule);
return ClassOrModuleRef::fromRaw(unsafeTableIndex());
}
// If Kind is Method, returns a MethodRef.
MethodRef asMethodRef() const {
ENFORCE_NO_TIMER(kind() == Kind::Method);
return MethodRef::fromRaw(unsafeTableIndex());
}
FieldRef asFieldRef() const {
ENFORCE_NO_TIMER(kind() == Kind::FieldOrStaticField);
return FieldRef::fromRaw(unsafeTableIndex());
}
TypeMemberRef asTypeMemberRef() const {
ENFORCE_NO_TIMER(kind() == Kind::TypeMember);
return TypeMemberRef::fromRaw(unsafeTableIndex());
}
TypeArgumentRef asTypeArgumentRef() const {
ENFORCE_NO_TIMER(kind() == Kind::TypeArgument);
return TypeArgumentRef::fromRaw(unsafeTableIndex());
}
public:
bool operator==(const SymbolRef &rhs) const;
bool operator!=(const SymbolRef &rhs) const;
// TODO(jvilk): Remove as many of these methods as possible in favor of callsites using .data on the more specific
// symbol *Ref classes (e.g., ClassOrModuleRef). These were introduced to wean the codebase from calling
// SymbolRef::data.
// Please do not add methods to this list.
ClassOrModuleRef enclosingClass(const GlobalState &gs) const;
std::string_view showKind(const GlobalState &gs) const;
core::NameRef name(const GlobalState &gs) const;
core::SymbolRef owner(const GlobalState &gs) const;
core::Loc loc(const GlobalState &gs) const;
bool isPrintable(const GlobalState &gs) const;
const InlinedVector<Loc, 2> &locs(const GlobalState &gs) const;
const TypePtr &resultType(const GlobalState &gs) const;
void setResultType(GlobalState &gs, const TypePtr &typePtr) const;
SymbolRef dealias(const GlobalState &gs) const;
// End methods that should be removed.
// Prints the fully qualified name of the symbol in a format that is suitable for showing to the user (e.g.
// "Owner::SymbolName")
std::string showFullName(const GlobalState &gs) const;
std::string showFullNameWithoutPackagePrefix(const GlobalState &gs) const;
std::string toStringFullName(const GlobalState &gs) const;
std::string showRaw(const GlobalState &gs) const {
bool showFull = false;
bool showRaw = true;
return toStringWithOptions(gs, 0, showFull, showRaw);
}
std::string toString(const GlobalState &gs) const {
bool showFull = false;
bool showRaw = false;
return toStringWithOptions(gs, 0, showFull, showRaw);
}
// Renders the full name of this Symbol in a form suitable for user display.
std::string show(const GlobalState &gs) const {
return show(gs, {});
};
std::string show(const GlobalState &gs, ShowOptions options) const;
};
CheckSize(SymbolRef, 4, 4);
class Symbols {
Symbols() = delete;
public:
static SymbolRef noSymbol() {
return SymbolRef();
}
static ClassOrModuleRef noClassOrModule() {
return ClassOrModuleRef();
}
static ClassOrModuleRef top() {
return ClassOrModuleRef::fromRaw(1);
}
static ClassOrModuleRef bottom() {
return ClassOrModuleRef::fromRaw(2);
}
static ClassOrModuleRef root() {
return ClassOrModuleRef::fromRaw(3);
}
static ClassOrModuleRef rootSingleton() {
return ClassOrModuleRef::fromRaw(4);
}
static ClassOrModuleRef todo() {
return ClassOrModuleRef::fromRaw(5);
}
static ClassOrModuleRef Object() {
return ClassOrModuleRef::fromRaw(6);
}
static ClassOrModuleRef Integer() {
return ClassOrModuleRef::fromRaw(7);
}
static ClassOrModuleRef Float() {
return ClassOrModuleRef::fromRaw(8);
}
static ClassOrModuleRef String() {
return ClassOrModuleRef::fromRaw(9);
}
static ClassOrModuleRef Symbol() {
return ClassOrModuleRef::fromRaw(10);
}
static ClassOrModuleRef Array() {
return ClassOrModuleRef::fromRaw(11);
}
static ClassOrModuleRef Hash() {
return ClassOrModuleRef::fromRaw(12);
}
static ClassOrModuleRef TrueClass() {
return ClassOrModuleRef::fromRaw(13);
}
static ClassOrModuleRef FalseClass() {
return ClassOrModuleRef::fromRaw(14);
}
static ClassOrModuleRef NilClass() {
return ClassOrModuleRef::fromRaw(15);
}
static ClassOrModuleRef untyped() {
return ClassOrModuleRef::fromRaw(16);
}
static ClassOrModuleRef Opus() {
return ClassOrModuleRef::fromRaw(17);
}
static ClassOrModuleRef T() {
return ClassOrModuleRef::fromRaw(18);
}
static ClassOrModuleRef Class() {
return ClassOrModuleRef::fromRaw(19);
}
static ClassOrModuleRef BasicObject() {
return ClassOrModuleRef::fromRaw(20);
}
static ClassOrModuleRef Kernel() {
return ClassOrModuleRef::fromRaw(21);
}
static ClassOrModuleRef Range() {
return ClassOrModuleRef::fromRaw(22);
}
static ClassOrModuleRef Regexp() {
return ClassOrModuleRef::fromRaw(23);
}
static ClassOrModuleRef Magic() {
return ClassOrModuleRef::fromRaw(24);
}
static ClassOrModuleRef MagicSingleton() {
return ClassOrModuleRef::fromRaw(25);
}
static ClassOrModuleRef Module() {
return ClassOrModuleRef::fromRaw(26);
}
static ClassOrModuleRef StandardError() {
return ClassOrModuleRef::fromRaw(27);
}
static ClassOrModuleRef Complex() {
return ClassOrModuleRef::fromRaw(28);
}
static ClassOrModuleRef Rational() {
return ClassOrModuleRef::fromRaw(29);
}
static ClassOrModuleRef T_Array() {
return ClassOrModuleRef::fromRaw(30);
}
static ClassOrModuleRef T_Hash() {
return ClassOrModuleRef::fromRaw(31);
}
static ClassOrModuleRef T_Proc() {
return ClassOrModuleRef::fromRaw(32);
}
static ClassOrModuleRef Proc() {
return ClassOrModuleRef::fromRaw(33);
}
static ClassOrModuleRef Enumerable() {
return ClassOrModuleRef::fromRaw(34);
}
static ClassOrModuleRef Set() {
return ClassOrModuleRef::fromRaw(35);
}
static ClassOrModuleRef Struct() {
return ClassOrModuleRef::fromRaw(36);
}
static ClassOrModuleRef File() {
return ClassOrModuleRef::fromRaw(37);
}
static ClassOrModuleRef Sorbet() {
return ClassOrModuleRef::fromRaw(38);
}
static ClassOrModuleRef Sorbet_Private() {
return ClassOrModuleRef::fromRaw(39);
}
static ClassOrModuleRef Sorbet_Private_Static() {
return ClassOrModuleRef::fromRaw(40);
}
static ClassOrModuleRef Sorbet_Private_StaticSingleton() {
return ClassOrModuleRef::fromRaw(41);
}
// Used as the superclass for symbols created to populate unresolvable ruby
// constants
static ClassOrModuleRef StubModule() {
return ClassOrModuleRef::fromRaw(42);
}
// Used to mark the presence of a mixin that we were unable to
// statically resolve to a module
static ClassOrModuleRef StubMixin() {
return ClassOrModuleRef::fromRaw(43);
}
// Used to mark the presence of a mixin that will be replaced with a real
// ClassOrModuleRef or StubMixin once resolution completes.
static ClassOrModuleRef PlaceholderMixin() {
return ClassOrModuleRef::fromRaw(44);
}
// Used to mark the presence of a superclass that we were unable to
// statically resolve to a class
static ClassOrModuleRef StubSuperClass() {
return ClassOrModuleRef::fromRaw(45);
}
static ClassOrModuleRef T_Enumerable() {
return ClassOrModuleRef::fromRaw(46);
}
static ClassOrModuleRef T_Range() {
return ClassOrModuleRef::fromRaw(47);
}
static ClassOrModuleRef T_Set() {
return ClassOrModuleRef::fromRaw(48);
}
static ClassOrModuleRef void_() {
return ClassOrModuleRef::fromRaw(49);
}
// Synthetic symbol used by resolver to mark type alias assignments.
static ClassOrModuleRef typeAliasTemp() {
return ClassOrModuleRef::fromRaw(50);
}
static ClassOrModuleRef T_Configuration() {
return ClassOrModuleRef::fromRaw(51);
}
static ClassOrModuleRef T_Generic() {
return ClassOrModuleRef::fromRaw(52);
}
static ClassOrModuleRef Tuple() {
return ClassOrModuleRef::fromRaw(53);
}
static ClassOrModuleRef Shape() {
return ClassOrModuleRef::fromRaw(54);
}
static ClassOrModuleRef Subclasses() {
return ClassOrModuleRef::fromRaw(55);
}
static ClassOrModuleRef Sorbet_Private_Static_ImplicitModuleSuperClass() {
return ClassOrModuleRef::fromRaw(56);
}
static ClassOrModuleRef Sorbet_Private_Static_ReturnTypeInference() {
return ClassOrModuleRef::fromRaw(57);
}
static MethodRef noMethod() {
return MethodRef();
}
static FieldRef noField() {
return FieldRef::fromRaw(0);
}
static TypeArgumentRef noTypeArgument() {
return TypeArgumentRef::fromRaw(0);
}
static TypeMemberRef noTypeMember() {
return TypeMemberRef::fromRaw(0);
}
static MethodRef Sorbet_Private_Static_ReturnTypeInference_guessed_type_type_parameter_holder() {
return MethodRef::fromRaw(1);
}
static TypeArgumentRef
Sorbet_Private_Static_ReturnTypeInference_guessed_type_type_parameter_holder_tparam_contravariant() {
return TypeArgumentRef::fromRaw(1);
}
static TypeArgumentRef
Sorbet_Private_Static_ReturnTypeInference_guessed_type_type_parameter_holder_tparam_covariant() {
return TypeArgumentRef::fromRaw(2);
}
static TypeArgumentRef todoTypeArgument() {
return TypeArgumentRef::fromRaw(3);
}
static ClassOrModuleRef T_Sig() {
return ClassOrModuleRef::fromRaw(58);
}
static FieldRef Magic_undeclaredFieldStub() {
return FieldRef::fromRaw(1);
}
static MethodRef Sorbet_Private_Static_badAliasMethodStub() {
return MethodRef::fromRaw(2);
}
static ClassOrModuleRef T_Helpers() {
return ClassOrModuleRef::fromRaw(59);
}
static ClassOrModuleRef DeclBuilderForProcs() {
return ClassOrModuleRef::fromRaw(60);
}
static ClassOrModuleRef DeclBuilderForProcsSingleton() {
return ClassOrModuleRef::fromRaw(61);
}
static ClassOrModuleRef Net() {
return ClassOrModuleRef::fromRaw(62);
}
static ClassOrModuleRef Net_IMAP() {
return ClassOrModuleRef::fromRaw(63);
}
static ClassOrModuleRef Net_Protocol() {
return ClassOrModuleRef::fromRaw(64);
}
static ClassOrModuleRef T_Sig_WithoutRuntime() {
return ClassOrModuleRef::fromRaw(65);
}
static ClassOrModuleRef Enumerator() {
return ClassOrModuleRef::fromRaw(66);
}
static ClassOrModuleRef T_Enumerator() {
return ClassOrModuleRef::fromRaw(67);
}
static ClassOrModuleRef T_Struct() {
return ClassOrModuleRef::fromRaw(68);
}
static ClassOrModuleRef Singleton() {
return ClassOrModuleRef::fromRaw(69);
}
static ClassOrModuleRef T_Enum() {
return ClassOrModuleRef::fromRaw(70);
}
static MethodRef sig() {
return MethodRef::fromRaw(3);
}
static ClassOrModuleRef Enumerator_Lazy() {
return ClassOrModuleRef::fromRaw(71);
}
static ClassOrModuleRef T_Private() {
return ClassOrModuleRef::fromRaw(72);
}
static ClassOrModuleRef T_Private_Types() {
return ClassOrModuleRef::fromRaw(73);
}
static ClassOrModuleRef T_Private_Types_Void() {
return ClassOrModuleRef::fromRaw(74);
}
static ClassOrModuleRef T_Private_Types_Void_VOID() {
return ClassOrModuleRef::fromRaw(75);
}
static ClassOrModuleRef T_Private_Types_Void_VOIDSingleton() {
return ClassOrModuleRef::fromRaw(76);
}
static ClassOrModuleRef T_Sig_WithoutRuntimeSingleton() {
return ClassOrModuleRef::fromRaw(77);
}
static MethodRef sigWithoutRuntime() {
return MethodRef::fromRaw(4);
}
static ClassOrModuleRef T_NonForcingConstants() {
return ClassOrModuleRef::fromRaw(78);
}
static MethodRef SorbetPrivateStaticSingleton_sig() {
return MethodRef::fromRaw(5);
}
static ClassOrModuleRef PackageRegistry() {
return ClassOrModuleRef::fromRaw(79);
}
static ClassOrModuleRef PackageTests() {
return ClassOrModuleRef::fromRaw(80);
}
static ClassOrModuleRef PackageSpec() {
return ClassOrModuleRef::fromRaw(81);
}
static ClassOrModuleRef PackageSpecSingleton() {
return ClassOrModuleRef::fromRaw(82);
}
static MethodRef PackageSpec_import() {
return MethodRef::fromRaw(6);
}
static MethodRef PackageSpec_test_import() {
return MethodRef::fromRaw(7);
}
static MethodRef PackageSpec_export() {
return MethodRef::fromRaw(8);
}
static MethodRef PackageSpec_export_for_test() {
return MethodRef::fromRaw(9);
}
static MethodRef PackageSpec_restrict_to_service() {
return MethodRef::fromRaw(10);
}
static ClassOrModuleRef Encoding() {
return ClassOrModuleRef::fromRaw(83);
}
static ClassOrModuleRef Thread() {
return ClassOrModuleRef::fromRaw(84);
}
static MethodRef Class_new() {
return MethodRef::fromRaw(11);
}
static MethodRef todoMethod() {
return MethodRef::fromRaw(12);
}
static ClassOrModuleRef Sorbet_Private_Static_ResolvedSig() {
return ClassOrModuleRef::fromRaw(85);
}
static ClassOrModuleRef Sorbet_Private_Static_ResolvedSigSingleton() {
return ClassOrModuleRef::fromRaw(86);
}
static ClassOrModuleRef T_Private_Compiler() {
return ClassOrModuleRef::fromRaw(87);
}
static ClassOrModuleRef T_Private_CompilerSingleton() {
return ClassOrModuleRef::fromRaw(88);
}
static ClassOrModuleRef MagicBindToAttachedClass() {
return ClassOrModuleRef::fromRaw(89);
}
static ClassOrModuleRef MagicBindToSelfType() {
return ClassOrModuleRef::fromRaw(90);
}
static ClassOrModuleRef T_Types() {
return ClassOrModuleRef::fromRaw(91);
}
static ClassOrModuleRef T_Types_Base() {
return ClassOrModuleRef::fromRaw(92);
}
static constexpr int MAX_PROC_ARITY = 10;
static ClassOrModuleRef Proc0() {
return ClassOrModuleRef::fromRaw(MAX_SYNTHETIC_CLASS_SYMBOLS - MAX_PROC_ARITY * 2 - 2);
}
static ClassOrModuleRef Proc(int argc) {
if (argc > MAX_PROC_ARITY) {
return ClassOrModuleRef();
}
return ClassOrModuleRef::fromRaw(Proc0().id() + argc * 2);
}