Skip to content

Commit

Permalink
Parse and lower never type
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwhit committed May 21, 2020
1 parent 1840c2c commit 5f2ae21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chalk-integration/src/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,12 @@ impl LowerTy for Ty {
substitution: chalk_ir::Substitution::empty(interner),
})
.intern(interner)),

Ty::Never => Ok(chalk_ir::TyData::Apply(chalk_ir::ApplicationTy {
name: chalk_ir::TypeName::Never,
substitution: chalk_ir::Substitution::empty(interner),
})
.intern(interner)),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions chalk-parse/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ pub enum Ty {
ty: Box<Ty>,
},
Str,
Never,
}

#[derive(Copy, Clone, PartialEq, Eq, Debug)]
Expand Down
1 change: 1 addition & 0 deletions chalk-parse/src/parser.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ TyWithoutId: Ty = {
},
<ScalarType> => Ty::Scalar { ty: <> },
"str" => Ty::Str,
"!" => Ty::Never,
"fn" "(" <t:Ty> ")" => Ty::ForAll {
lifetime_names: vec![],
ty: Box::new(t)
Expand Down

0 comments on commit 5f2ae21

Please sign in to comment.