mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Merge pull request #452 from crystal-ameba/reopen-issue-447
This commit is contained in:
		
						commit
						63be60ce96
					
				
					 2 changed files with 4 additions and 11 deletions
				
			
		|  | @ -402,11 +402,12 @@ module Ameba::Rule::Lint | |||
|           CRYSTAL | ||||
|       end | ||||
| 
 | ||||
|       it "doesn't report type declaration as a call argument" do | ||||
|       pending "doesn't report type declaration as a call argument" do | ||||
|         expect_no_issues subject, <<-CRYSTAL | ||||
|           foo Foo(T), foo : T | ||||
|           foo Foo, foo : Nil | ||||
|           foo foo : String, bar : Int32? | ||||
|           foo foo : String | ||||
|           foo foo : String, bar : Int32?, baz : Bool | ||||
|           CRYSTAL | ||||
|       end | ||||
| 
 | ||||
|  |  | |||
|  | @ -43,10 +43,7 @@ module Ameba::Rule::Lint | |||
| 
 | ||||
|       scope.variables.each do |var| | ||||
|         next if var.ignored? || var.used_in_macro? || var.captured_by_block? | ||||
| 
 | ||||
|         if scope.assigns_type_dec?(var.name) | ||||
|           next if exclude_type_declarations? || expressions_with_call?(node) | ||||
|         end | ||||
|         next if exclude_type_declarations? && scope.assigns_type_dec?(var.name) | ||||
| 
 | ||||
|         var.assignments.each do |assign| | ||||
|           check_assignment(source, assign, var) | ||||
|  | @ -54,11 +51,6 @@ module Ameba::Rule::Lint | |||
|       end | ||||
|     end | ||||
| 
 | ||||
|     private def expressions_with_call?(node) | ||||
|       node.is_a?(Crystal::Expressions) && | ||||
|         node.expressions.first?.is_a?(Crystal::Call) | ||||
|     end | ||||
| 
 | ||||
|     private def check_assignment(source, assign, var) | ||||
|       return if assign.referenced? | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue