@@ -211,7 +211,6 @@ impl<'a> Resolver<'a> {
211211 }
212212 Outcome :: Unresolved ( None ) => {
213213 // We couldn't resolve this name. Emit a diagnostic
214- self . unit_queue . push_back ( unit_id) ;
215214 }
216215 Outcome :: Retry ( Some ( id_needing_linearization) ) | Outcome :: Unresolved ( Some ( id_needing_linearization) ) => {
217216 self . unit_queue . push_back ( unit_id) ;
@@ -1673,8 +1672,8 @@ mod tests {
16731672 assert_constant_reference_to, assert_declaration_definitions_count_eq, assert_declaration_does_not_exist,
16741673 assert_declaration_exists, assert_declaration_kind_eq, assert_declaration_references_count_eq,
16751674 assert_descendants, assert_diagnostics_eq, assert_instance_variables_eq, assert_members_eq,
1676- assert_no_constant_alias_target, assert_no_diagnostics, assert_no_members, assert_no_todo_declarations ,
1677- assert_owner_eq , assert_singleton_class_eq, assert_todo_declarations_eq ,
1675+ assert_no_constant_alias_target, assert_no_diagnostics, assert_no_members, assert_owner_eq ,
1676+ assert_singleton_class_eq,
16781677 } ;
16791678
16801679 #[ test]
@@ -1802,7 +1801,6 @@ mod tests {
18021801 context. resolve ( ) ;
18031802
18041803 assert_no_diagnostics ! ( & context) ;
1805- assert_no_todo_declarations ! ( context) ;
18061804
18071805 assert_members_eq ! ( context, "Foo" , [ "Bar" , "Baz" ] ) ;
18081806 assert_owner_eq ! ( context, "Foo" , "Object" ) ;
@@ -1860,7 +1858,6 @@ mod tests {
18601858 context. resolve ( ) ;
18611859
18621860 assert_no_diagnostics ! ( & context) ;
1863- assert_no_todo_declarations ! ( context) ;
18641861
18651862 assert_no_members ! ( context, "Foo" ) ;
18661863 assert_owner_eq ! ( context, "Foo" , "Object" ) ;
@@ -1885,7 +1882,6 @@ mod tests {
18851882 context. resolve ( ) ;
18861883
18871884 assert_no_diagnostics ! ( & context) ;
1888- assert_no_todo_declarations ! ( context) ;
18891885
18901886 assert_no_members ! ( context, "Foo" ) ;
18911887 assert_owner_eq ! ( context, "Foo" , "Object" ) ;
@@ -1912,7 +1908,7 @@ mod tests {
19121908
19131909 assert_no_diagnostics ! ( & context) ;
19141910
1915- assert_todo_declarations_eq ! ( context, [ "Foo" ] ) ;
1911+ assert_declaration_kind_eq ! ( context, "Foo" , "<TODO>" ) ;
19161912
19171913 assert_members_eq ! ( context, "Object" , vec![ "Foo" ] ) ;
19181914 assert_members_eq ! ( context, "Foo" , vec![ "Bar" ] ) ;
@@ -4152,7 +4148,6 @@ mod tests {
41524148 context. resolve ( ) ;
41534149
41544150 assert_no_diagnostics ! ( & context) ;
4155- assert_no_todo_declarations ! ( context) ;
41564151
41574152 // In the same order of appearence
41584153 assert_declaration_exists ! ( context, "Foo" ) ;
@@ -4198,7 +4193,6 @@ mod tests {
41984193 context. resolve ( ) ;
41994194
42004195 assert_no_diagnostics ! ( & context, & [ Rule :: ParseWarning ] ) ;
4201- assert_no_todo_declarations ! ( context) ;
42024196
42034197 // FIXME: this is wrong, the reference is not to `Bar::Foo`, but to `Foo`
42044198 assert_constant_reference_to ! ( context, "Bar::Foo" , "file:///foo.rb:4:3-4:6" ) ;
@@ -5036,11 +5030,71 @@ mod tests {
50365030
50375031 assert_no_diagnostics ! ( & context) ;
50385032
5039- assert_todo_declarations_eq ! ( context, [ "Foo" ] ) ;
5033+ assert_declaration_kind_eq ! ( context, "Foo" , "<TODO>" ) ;
50405034
50415035 assert_members_eq ! ( context, "Object" , vec![ "Foo" ] ) ;
50425036 assert_members_eq ! ( context, "Foo" , vec![ "Bar" , "Baz" ] ) ;
50435037 assert_members_eq ! ( context, "Foo::Bar" , vec![ "bar()" ] ) ;
50445038 assert_members_eq ! ( context, "Foo::Baz" , vec![ "baz()" ] ) ;
50455039 }
5040+
5041+ #[ test]
5042+ fn todo_declaration_promoted_to_real_namespace ( ) {
5043+ let mut context = GraphTest :: new ( ) ;
5044+ context. index_uri ( "file:///foo.rb" , {
5045+ r"
5046+ class Foo::Bar
5047+ def bar; end
5048+ end
5049+
5050+ class Foo
5051+ def foo; end
5052+ end
5053+ "
5054+ } ) ;
5055+ context. resolve ( ) ;
5056+
5057+ assert_no_diagnostics ! ( & context) ;
5058+
5059+ // Foo was initially created as a Todo (from class Foo::Bar), then promoted to Class
5060+ assert_declaration_kind_eq ! ( context, "Foo" , "Class" ) ;
5061+
5062+ assert_members_eq ! ( context, "Object" , vec![ "Foo" ] ) ;
5063+ assert_members_eq ! ( context, "Foo" , vec![ "Bar" , "foo()" ] ) ;
5064+ assert_members_eq ! ( context, "Foo::Bar" , vec![ "bar()" ] ) ;
5065+ }
5066+
5067+ #[ test]
5068+ fn todo_declaration_promoted_to_real_namespace_incrementally ( ) {
5069+ let mut context = GraphTest :: new ( ) ;
5070+ context. index_uri ( "file:///bar.rb" , {
5071+ r"
5072+ class Foo::Bar
5073+ def bar; end
5074+ end
5075+ "
5076+ } ) ;
5077+ context. resolve ( ) ;
5078+
5079+ assert_no_diagnostics ! ( & context) ;
5080+ assert_declaration_kind_eq ! ( context, "Foo" , "<TODO>" ) ;
5081+
5082+ context. index_uri ( "file:///foo.rb" , {
5083+ r"
5084+ class Foo
5085+ def foo; end
5086+ end
5087+ "
5088+ } ) ;
5089+ context. resolve ( ) ;
5090+
5091+ assert_no_diagnostics ! ( & context) ;
5092+
5093+ // Foo was promoted from Todo to Class after the second resolution
5094+ assert_declaration_kind_eq ! ( context, "Foo" , "Class" ) ;
5095+
5096+ assert_members_eq ! ( context, "Object" , vec![ "Foo" ] ) ;
5097+ assert_members_eq ! ( context, "Foo" , vec![ "Bar" , "foo()" ] ) ;
5098+ assert_members_eq ! ( context, "Foo::Bar" , vec![ "bar()" ] ) ;
5099+ }
50465100}
0 commit comments