File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1580,6 +1580,7 @@ impl<'db> InferenceContext<'db> {
1580
1580
Some ( path) => path,
1581
1581
None => return ( self . err_ty ( ) , None ) ,
1582
1582
} ;
1583
+
1583
1584
let mut ctx = TyLoweringContext :: new (
1584
1585
self . db ,
1585
1586
& self . resolver ,
@@ -1589,6 +1590,25 @@ impl<'db> InferenceContext<'db> {
1589
1590
self . generic_def ,
1590
1591
LifetimeElisionKind :: Infer ,
1591
1592
) ;
1593
+
1594
+ if let Some ( type_anchor) = path. type_anchor ( ) {
1595
+ let segments = path. segments ( ) ;
1596
+ if segments. len ( ) != 1 {
1597
+ return ( self . err_ty ( ) , None ) ;
1598
+ }
1599
+ let ty = ctx. lower_ty ( type_anchor) ;
1600
+ if let Some ( ( AdtId :: EnumId ( id) , _) ) = ty. as_adt ( ) {
1601
+ let enum_data = self . db . enum_variants ( id) ;
1602
+ if let Some ( variant) = enum_data. variant ( segments. first ( ) . unwrap ( ) . name ) {
1603
+ // FIXME: Report error if there are generics on the variant.
1604
+ return ( ty, Some ( variant. into ( ) ) ) ;
1605
+ }
1606
+ } else {
1607
+ // FIXME: Report an error.
1608
+ return ( self . err_ty ( ) , None ) ;
1609
+ }
1610
+ }
1611
+
1592
1612
let mut path_ctx = ctx. at_path ( path, node) ;
1593
1613
let ( resolution, unresolved) = if value_ns {
1594
1614
let Some ( res) = path_ctx. resolve_path_in_value_ns ( HygieneId :: ROOT ) else {
You can’t perform that action at this time.
0 commit comments