Skip to content

Commit 5287ba6

Browse files
authored
Merge pull request #163 from sunjay/compatible-downstreamtype-parse
Add parsing for Compatible and DownstreamType
2 parents 2a86f96 + 0a9ca8b commit 5287ba6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

chalk-parse/src/ast.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ pub enum DomainGoal {
259259
IsUpstream { ty: Ty },
260260
IsFullyVisible { ty: Ty },
261261
LocalImplAllowed { trait_ref: TraitRef },
262+
Compatible,
263+
DownstreamType { ty: Ty },
262264
}
263265

264266
#[derive(Clone, PartialEq, Eq, Debug)]

chalk-parse/src/parser.lalrpop

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ DomainGoal: DomainGoal = {
305305
"IsFullyVisible" "(" <ty:Ty> ")" => DomainGoal::IsFullyVisible { ty },
306306

307307
"LocalImplAllowed" "(" <trait_ref:TraitRef<":">> ")" => DomainGoal::LocalImplAllowed { trait_ref },
308+
309+
"Compatible" => DomainGoal::Compatible,
310+
"DownstreamType" "(" <ty:Ty> ")" => DomainGoal::DownstreamType { ty },
308311
};
309312

310313
LeafGoal: LeafGoal = {

src/ir/lowering.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,12 @@ impl LowerDomainGoal for DomainGoal {
530530
DomainGoal::LocalImplAllowed { trait_ref } => vec![
531531
ir::DomainGoal::LocalImplAllowed(trait_ref.lower(env)?)
532532
],
533+
DomainGoal::Compatible => vec![
534+
ir::DomainGoal::Compatible(())
535+
],
536+
DomainGoal::DownstreamType { ty } => vec![
537+
ir::DomainGoal::DownstreamType(ty.lower(env)?)
538+
],
533539
};
534540
Ok(goals)
535541
}

0 commit comments

Comments
 (0)