@@ -24,7 +24,7 @@ public enum Type: Equatable, CustomStringConvertible, Sendable {
2424 /// A type that has been aliased. These are not in SQL by default
2525 /// but are from the layer on top that we are adding so a user
2626 /// can replace a `INTEGER` with a `Bool`
27- indirect case alias( Type , Alias )
27+ indirect case alias( Type , Alias , coder : Substring ? )
2828 /// There was an error somewhere in the analysis. We can just return
2929 /// an `error` type and continue the analysis. So if the user makes up
3030 /// 3 columns, they can get all 3 errors at once.
@@ -43,7 +43,7 @@ public enum Type: Equatable, CustomStringConvertible, Sendable {
4343 static let real : Type = . nominal( " REAL " )
4444 static let blob : Type = . nominal( " BLOB " )
4545 static let any : Type = . nominal( " ANY " )
46- static let boolean : Type = . alias( . integer, . hint( . bool) )
46+ static let boolean : Type = . alias( . integer, . hint( . bool) , coder : nil )
4747
4848 static let validTypeNames : Set < Substring > = [
4949 " TEXT " , " INT " , " INTEGER " , " REAL " , " BLOB " , " ANY " ,
@@ -89,15 +89,15 @@ public enum Type: Equatable, CustomStringConvertible, Sendable {
8989 case let . unknown( ty) : " ( \( ty) ...) "
9090 }
9191 case let . optional( ty) : " \( ty) ? "
92- case let . alias( t, a) : " ( \( t) AS \( a) ) "
92+ case let . alias( t, a, _ ) : " ( \( t) AS \( a) ) "
9393 case . error: " <<error>> "
9494 }
9595 }
9696
9797 /// The underlying root inner type
9898 var root : Type {
9999 return switch self {
100- case let . alias( t, _) : t. root
100+ case let . alias( t, _, _ ) : t. root
101101 case let . optional( t) : t. root
102102 default : self
103103 }
@@ -115,7 +115,7 @@ public enum Type: Equatable, CustomStringConvertible, Sendable {
115115 var isOptional : Bool {
116116 switch self {
117117 case . nominal, . error, . row, . fn, . var: false
118- case let . alias( t, _) : t. isOptional
118+ case let . alias( t, _, _ ) : t. isOptional
119119 case . optional: true
120120 }
121121 }
@@ -129,7 +129,7 @@ public enum Type: Equatable, CustomStringConvertible, Sendable {
129129 /// The alias if there is one
130130 var alias : Alias ? {
131131 switch self {
132- case . alias( _, let a) : a
132+ case . alias( _, let a, _ ) : a
133133 case . optional( let t) : t. alias
134134 default : nil
135135 }
@@ -165,8 +165,8 @@ public enum Type: Equatable, CustomStringConvertible, Sendable {
165165 return . row( tys. apply ( s) )
166166 case let . optional( ty) :
167167 return . optional( ty. apply ( s) )
168- case let . alias( t, a) :
169- return . alias( t. apply ( s) , a)
168+ case let . alias( t, a, c ) :
169+ return . alias( t. apply ( s) , a, coder : c )
170170 case . nominal, . error:
171171 // Literals can't be substituted for.
172172 return self
0 commit comments