@@ -37,95 +37,53 @@ inline def inputVariadicity[Elem] = inline erasedValue[Elem] match
37
37
// tries to match on that type exactly (ie. unwrappedType[Value[IntegerType]] for example) rather than the matched type...
38
38
// very weird things going on
39
39
40
- type unwrappedInput [Elem ] = Elem match
41
- case Variadic [t] => t
42
- case _ => Elem
43
-
44
- // workaround for unwrappedType to make sure that variadics work, it is ugly, but it is :'(
45
- inline def getVariadicDefInput [Label , Elem ]: OpInput = {
40
+ /** Produces an OpInput to OperationDef given a definition of a Type.
41
+ *
42
+ * @return
43
+ * Input to OperationDef, either: OperandDef, ResultDef, RegionDef,
44
+ * SuccessorDef, OpPropertyDef, OpAttributeDef
45
+ */
46
+ inline def getDefInput [Label , Elem ]: OpInput = {
46
47
47
48
val name = inline erasedValue[Label ] match
48
49
case _ : String => constValue[Label ].asInstanceOf [String ]
49
50
case _ =>
50
51
throw new Exception (" Internal error!" )
51
52
52
53
inline erasedValue[Elem ] match
53
- case _ : Result [t ] =>
54
- ResultDef (
54
+ case _ : Variadic [ Operand [t] ] =>
55
+ OperandDef (
55
56
id = name,
56
57
typeString = typeToString[t],
57
58
Variadicity .Variadic
58
59
)
59
- case _ : Operand [t ] =>
60
+ case _ : Variadic [ Result [t] ] =>
60
61
OperandDef (
61
62
id = name,
62
63
typeString = typeToString[t],
63
64
Variadicity .Variadic
64
65
)
65
- case _ : Region =>
66
- RegionDef (
67
- id = name,
68
- Variadicity .Variadic
69
- )
70
- case _ : Successor =>
71
- SuccessorDef (
72
- id = name,
73
- Variadicity .Variadic
74
- )
75
- case _ : Property [t] =>
76
- OpPropertyDef (
77
- id = name,
78
- typeString = typeToString[t]
79
- )
80
- case _ : Attr [t] =>
81
- OpAttributeDef (
82
- id = name,
83
- typeString = typeToString[t]
84
- )
85
- case _ =>
86
- throw new Exception (
87
- s " Unsupported shennaigans with variadic field $name of type ${typeToString[Elem ]}"
88
- )
89
- }
90
-
91
- /** Produces an OpInput to OperationDef given a definition of a Type.
92
- *
93
- * @return
94
- * Input to OperationDef, either: OperandDef, ResultDef, RegionDef,
95
- * SuccessorDef, OpPropertyDef, OpAttributeDef
96
- */
97
- inline def getDefInput [Label , Elem ]: OpInput = {
98
-
99
- val name = inline erasedValue[Label ] match
100
- case _ : String => constValue[Label ].asInstanceOf [String ]
101
- case _ =>
102
- throw new Exception (" Internal error!" )
103
-
104
- inline erasedValue[Elem ] match
105
- case _ : Variadic [t] =>
106
- getVariadicDefInput[Label , t]
107
-
108
66
case _ : Result [t] =>
109
67
ResultDef (
110
68
id = name,
111
69
typeString = typeToString[t],
112
- inputVariadicity[ Elem ]
70
+ Variadicity . Single
113
71
)
114
72
case _ : Operand [t] =>
115
73
OperandDef (
116
74
id = name,
117
75
typeString = typeToString[t],
118
- inputVariadicity[ Elem ]
76
+ Variadicity . Single
119
77
)
120
78
case _ : Region =>
121
79
RegionDef (
122
80
id = name,
123
- inputVariadicity[ Elem ]
81
+ Variadicity . Single
124
82
)
125
83
case _ : Successor =>
126
84
SuccessorDef (
127
85
id = name,
128
- inputVariadicity[ Elem ]
86
+ Variadicity . Single
129
87
)
130
88
case _ : Property [t] =>
131
89
OpPropertyDef (
@@ -139,7 +97,7 @@ inline def getDefInput[Label, Elem]: OpInput = {
139
97
)
140
98
case _ =>
141
99
throw new Exception (
142
- s " Unsupported shennaigans with field $name of type ${typeToString[Elem ]}"
100
+ s " Unsupported shennaigans here with field $name of type ${typeToString[Elem ]}"
143
101
)
144
102
}
145
103
0 commit comments