From 8f070829bf9c96206cdfbe67fc43d54d429cd725 Mon Sep 17 00:00:00 2001 From: DasLixou Date: Thu, 9 May 2024 15:57:13 +0200 Subject: [PATCH] Fix Snapshots --- ...asic__main.snap.new => basic__main-2.snap} | 61 +- ohdlc/tests/snapshots/basic__main.snap | 544 ++++++++++++++++++ 2 files changed, 574 insertions(+), 31 deletions(-) rename ohdlc/tests/snapshots/{basic__main.snap.new => basic__main-2.snap} (80%) create mode 100644 ohdlc/tests/snapshots/basic__main.snap diff --git a/ohdlc/tests/snapshots/basic__main.snap.new b/ohdlc/tests/snapshots/basic__main-2.snap similarity index 80% rename from ohdlc/tests/snapshots/basic__main.snap.new rename to ohdlc/tests/snapshots/basic__main-2.snap index 36105e3..40df76a 100644 --- a/ohdlc/tests/snapshots/basic__main.snap.new +++ b/ohdlc/tests/snapshots/basic__main-2.snap @@ -1,6 +1,5 @@ --- source: tests/basic.rs -assertion_line: 90 expression: refined_types --- Registry { @@ -8,7 +7,7 @@ Registry { ModuleId( 0, ): Module { - name: `std`:4..7, + name: `std`:34..37, scope: ScopeId( 1, ), @@ -16,7 +15,7 @@ Registry { ModuleId( 1, ): Module { - name: `x`:89..90, + name: `x`:119..120, scope: ScopeId( 2, ), @@ -24,7 +23,7 @@ Registry { ModuleId( 2, ): Module { - name: `y`:111..112, + name: `y`:141..142, scope: ScopeId( 3, ), @@ -32,7 +31,7 @@ Registry { ModuleId( 3, ): Module { - name: `a`:420..421, + name: `a`:450..451, scope: ScopeId( 4, ), @@ -40,7 +39,7 @@ Registry { ModuleId( 4, ): Module { - name: `other`:449..454, + name: `other`:479..484, scope: ScopeId( 5, ), @@ -48,7 +47,7 @@ Registry { ModuleId( 5, ): Module { - name: `b`:465..466, + name: `b`:495..496, scope: ScopeId( 6, ), @@ -62,13 +61,13 @@ Registry { type_id: TypeId( 0, ), - name: `Logical`:19..26, + name: `Logical`:49..56, variants: [ Variant { - ident: `High`:37..41, + ident: `High`:67..71, }, Variant { - ident: `Low`:51..54, + ident: `Low`:81..84, }, ], }, @@ -80,10 +79,10 @@ Registry { type_id: TypeId( 1, ), - name: `MyRecord`:136..144, + name: `MyRecord`:166..174, fields: [ Field { - name: `a`:151..152, + name: `a`:181..182, ty: Some( TypeId( 0, @@ -91,7 +90,7 @@ Registry { ), }, Field { - name: `b`:167..168, + name: `b`:197..198, ty: Some( TypeId( 0, @@ -108,22 +107,22 @@ Registry { type_id: TypeId( 2, ), - name: `MyEnum`:187..193, + name: `MyEnum`:217..223, variants: [ Variant { - ident: `A`:200..201, + ident: `A`:230..231, }, Variant { - ident: `B`:207..208, + ident: `B`:237..238, }, Variant { - ident: `C`:214..215, + ident: `C`:244..245, }, Variant { - ident: `D`:221..222, + ident: `D`:251..252, }, Variant { - ident: `E`:228..229, + ident: `E`:258..259, }, ], }, @@ -135,11 +134,11 @@ Registry { type_id: TypeId( 3, ), - name: `HalfAdder`:241..250, + name: `HalfAdder`:271..280, ports: [ Port { kind: Input, - name: `a`:261..262, + name: `a`:291..292, ty: Some( TypeId( 0, @@ -148,7 +147,7 @@ Registry { }, Port { kind: Input, - name: `b`:281..282, + name: `b`:311..312, ty: Some( TypeId( 0, @@ -157,7 +156,7 @@ Registry { }, Port { kind: Output, - name: `o`:301..302, + name: `o`:331..332, ty: Some( TypeId( 0, @@ -166,7 +165,7 @@ Registry { }, Port { kind: Output, - name: `c`:321..322, + name: `c`:351..352, ty: Some( TypeId( 0, @@ -183,7 +182,7 @@ Registry { type_id: TypeId( 4, ), - name: `Lol`:484..487, + name: `Lol`:514..517, ports: [], }, ), @@ -194,11 +193,11 @@ Registry { type_id: TypeId( 5, ), - name: `FullAdder`:508..517, + name: `FullAdder`:538..547, ports: [ Port { kind: Input, - name: `a`:528..529, + name: `a`:558..559, ty: Some( TypeId( 0, @@ -207,7 +206,7 @@ Registry { }, Port { kind: Input, - name: `b`:548..549, + name: `b`:578..579, ty: Some( TypeId( 0, @@ -216,7 +215,7 @@ Registry { }, Port { kind: Input, - name: `ci`:568..570, + name: `ci`:598..600, ty: Some( TypeId( 0, @@ -225,7 +224,7 @@ Registry { }, Port { kind: Output, - name: `o`:589..590, + name: `o`:619..620, ty: Some( TypeId( 0, @@ -234,7 +233,7 @@ Registry { }, Port { kind: Output, - name: `co`:609..611, + name: `co`:639..641, ty: Some( TypeId( 0, diff --git a/ohdlc/tests/snapshots/basic__main.snap b/ohdlc/tests/snapshots/basic__main.snap new file mode 100644 index 0000000..a578a71 --- /dev/null +++ b/ohdlc/tests/snapshots/basic__main.snap @@ -0,0 +1,544 @@ +--- +source: tests/basic.rs +expression: root +--- +[ + Module( + Module { + name: `std`:34..37, + items: [ + Enum( + Enum { + name: `Logical`:49..56, + variants: [ + `High`:67..71, + `Low`:81..84, + ], + }, + ):44..93, + ], + }, + ):30..97, + Use( + Use { + path: Path( + [ + PathSegment( + `std`:100..103, + ), + PathSegment( + `Logical`:105..112, + ), + ], + Root, + ):98..113, + }, + ):94..118, + Module( + Module { + name: `x`:119..120, + items: [ + Use( + Use { + path: Path( + [ + PathSegment( + `y`:131..132, + ), + ], + Local, + ):131..133, + }, + ):127..135, + ], + }, + ):115..140, + Module( + Module { + name: `y`:141..142, + items: [ + Use( + Use { + path: Path( + [ + PathSegment( + `x`:153..154, + ), + ], + Local, + ):153..155, + }, + ):149..157, + ], + }, + ):137..165, + Record( + Record { + name: `MyRecord`:166..174, + fields: [ + Field { + name: `a`:181..182, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:184..191, + ), + ], + Local, + ):184..192, + }:184..192, + }:181..192, + Field { + name: `b`:197..198, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:200..207, + ), + ], + Local, + ):200..208, + }:200..208, + }:197..208, + ], + }, + ):159..216, + Enum( + Enum { + name: `MyEnum`:217..223, + variants: [ + `A`:230..231, + `B`:237..238, + `C`:244..245, + `D`:251..252, + `E`:258..259, + ], + }, + ):212..270, + Entity( + Entity { + name: `HalfAdder`:271..280, + ports: [ + Port { + kind: Input:287..289, + name: `a`:291..292, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:294..301, + ), + ], + Local, + ):294..302, + }:294..302, + }:287..302, + Port { + kind: Input:307..309, + name: `b`:311..312, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:314..321, + ), + ], + Local, + ):314..322, + }:314..322, + }:307..322, + Port { + kind: Output:327..330, + name: `o`:331..332, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:334..341, + ), + ], + Local, + ):334..342, + }:334..342, + }:327..342, + Port { + kind: Output:347..350, + name: `c`:351..352, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:354..361, + ), + ], + Local, + ):354..362, + }:354..362, + }:347..362, + ], + }, + ):264..370, + Arch( + Arch { + name: `RTL`:371..374, + ty: Type { + path: Path( + [ + PathSegment( + `HalfAdder`:379..388, + ), + ], + Local, + ):379..390, + }:379..390, + stmts: [ + Assign( + AssignStmt { + assignee: `o`:395..396, + value: Binary { + left: Primary( + `a`:400..401, + ), + right: Primary( + `b`:406..407, + ), + operator: Xor, + }, + }, + ):395..414, + Assign( + AssignStmt { + assignee: `c`:413..414, + value: Binary { + left: Primary( + `a`:418..419, + ), + right: Primary( + `b`:424..425, + ), + operator: And, + }, + }, + ):413..428, + ], + }, + ):366..433, + Use( + Use { + path: Path( + [ + PathSegment( + `a`:434..435, + ), + PathSegment( + `b`:437..438, + ), + PathSegment( + `Lol`:440..443, + ), + ], + Local, + ):434..444, + }, + ):430..449, + Module( + Module { + name: `a`:450..451, + items: [ + Use( + Use { + path: Path( + [ + PathSegment( + `other`:462..467, + ), + PathSegment( + `b`:469..470, + ), + ], + Local, + ):462..471, + }, + ):458..473, + ], + }, + ):446..478, + Module( + Module { + name: `other`:479..484, + items: [ + Module( + Module { + name: `b`:495..496, + items: [ + Entity( + Entity { + name: `Lol`:514..517, + ports: [], + }, + ):507..527, + ], + }, + ):491..529, + ], + }, + ):475..537, + Entity( + Entity { + name: `FullAdder`:538..547, + ports: [ + Port { + kind: Input:554..556, + name: `a`:558..559, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:561..568, + ), + ], + Local, + ):561..569, + }:561..569, + }:554..569, + Port { + kind: Input:574..576, + name: `b`:578..579, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:581..588, + ), + ], + Local, + ):581..589, + }:581..589, + }:574..589, + Port { + kind: Input:594..596, + name: `ci`:598..600, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:602..609, + ), + ], + Local, + ):602..610, + }:602..610, + }:594..610, + Port { + kind: Output:615..618, + name: `o`:619..620, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:622..629, + ), + ], + Local, + ):622..630, + }:622..630, + }:615..630, + Port { + kind: Output:635..638, + name: `co`:639..641, + ty: Type { + path: Path( + [ + PathSegment( + `Logical`:643..650, + ), + ], + Local, + ):643..651, + }:643..651, + }:635..651, + ], + }, + ):531..659, + Arch( + Arch { + name: `RTL`:660..663, + ty: Type { + path: Path( + [ + PathSegment( + `FullAdder`:668..677, + ), + ], + Local, + ):668..679, + }:668..679, + stmts: [ + Place( + PlaceStmt { + entity_ty: Type { + path: Path( + [ + PathSegment( + `HalfAdder`:684..693, + ), + ], + Local, + ):684..694, + }:684..694, + arch_ty: Type { + path: Path( + [ + PathSegment( + `RTL`:694..697, + ), + ], + Local, + ):694..698, + }:694..698, + links: [ + PlaceLink { + src: `a`:709..710, + arrow_span: Span( + 711, + 713, + ), + link: Ingoing( + Primary( + `a`:714..715, + ):714..716, + ), + }:709..716, + PlaceLink { + src: `b`:725..726, + arrow_span: Span( + 727, + 729, + ), + link: Ingoing( + Primary( + `b`:730..731, + ):730..732, + ), + }:725..732, + PlaceLink { + src: `o`:741..742, + arrow_span: Span( + 743, + 745, + ), + link: Outgoing( + NewSignal( + `s`:753..754, + ):746..755, + ), + }:741..755, + PlaceLink { + src: `c`:764..765, + arrow_span: Span( + 766, + 768, + ), + link: Outgoing( + NewSignal( + `cb`:776..778, + ):769..779, + ), + }:764..779, + ], + }, + ):684..800, + Place( + PlaceStmt { + entity_ty: Type { + path: Path( + [ + PathSegment( + `HalfAdder`:791..800, + ), + ], + Local, + ):791..801, + }:791..801, + arch_ty: Type { + path: Path( + [ + PathSegment( + `RTL`:801..804, + ), + ], + Local, + ):801..805, + }:801..805, + links: [ + PlaceLink { + src: `a`:816..817, + arrow_span: Span( + 818, + 820, + ), + link: Ingoing( + Primary( + `s`:821..822, + ):821..823, + ), + }:816..823, + PlaceLink { + src: `b`:832..833, + arrow_span: Span( + 834, + 836, + ), + link: Ingoing( + Primary( + `ci`:837..839, + ):837..840, + ), + }:832..840, + PlaceLink { + src: `o`:849..850, + arrow_span: Span( + 851, + 853, + ), + link: Outgoing( + Ref( + `o`:854..855, + ):854..856, + ), + }:849..856, + PlaceLink { + src: `c`:865..866, + arrow_span: Span( + 867, + 869, + ), + link: Outgoing( + NewSignal( + `cc`:877..879, + ):870..880, + ), + }:865..880, + ], + }, + ):791..894, + Assign( + AssignStmt { + assignee: `co`:892..894, + value: Binary { + left: Primary( + `cb`:898..900, + ), + right: Primary( + `cc`:904..906, + ), + operator: Or, + }, + }, + ):892..909, + ], + }, + ):655..909, +]