From 8e3672a427d61a0db2d013a6ccbfe9fb4c341e0d Mon Sep 17 00:00:00 2001 From: Soutaro Matsumoto Date: Tue, 8 Oct 2024 20:45:04 +0900 Subject: [PATCH] Fix output tests --- smoke/array/test_expectations.yml | 46 +++++++++++++++++++++++++------ smoke/block/test_expectations.yml | 2 +- smoke/hash/test_expectations.yml | 2 +- smoke/tsort/a.rb | 2 +- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/smoke/array/test_expectations.yml b/smoke/array/test_expectations.yml index 326887d69..72003fda6 100644 --- a/smoke/array/test_expectations.yml +++ b/smoke/array/test_expectations.yml @@ -20,6 +20,19 @@ | (::Range[(::Integer | nil)], ::Array[::Integer]) -> ::Array[::Integer] | (::Range[(::Integer | nil)], nil) -> nil code: Ruby::UnresolvedOverloading + - range: + start: + line: 9 + character: 0 + end: + line: 9 + character: 8 + severity: ERROR + message: |- + Cannot assign a value of type `(::Integer | nil)` to a variable of type `::Integer` + (::Integer | nil) <: ::Integer + nil <: ::Integer + code: Ruby::IncompatibleAssignment - range: start: line: 12 @@ -29,11 +42,25 @@ character: 8 severity: ERROR message: |- - Cannot assign a value of type `::Integer` to a variable of type `::String` - ::Integer <: ::String - ::Numeric <: ::String - ::Object <: ::String - ::BasicObject <: ::String + Cannot assign a value of type `(::Integer | nil)` to a variable of type `::String` + (::Integer | nil) <: ::String + ::Integer <: ::String + ::Numeric <: ::String + ::Object <: ::String + ::BasicObject <: ::String + code: Ruby::IncompatibleAssignment + - range: + start: + line: 17 + character: 0 + end: + line: 17 + character: 8 + severity: ERROR + message: |- + Cannot assign a value of type `(::String | nil)` to a variable of type `::String` + (::String | nil) <: ::String + nil <: ::String code: Ruby::IncompatibleAssignment - range: start: @@ -44,10 +71,11 @@ character: 8 severity: ERROR message: |- - Cannot assign a value of type `::String` to a variable of type `::Integer` - ::String <: ::Integer - ::Object <: ::Integer - ::BasicObject <: ::Integer + Cannot assign a value of type `(::String | nil)` to a variable of type `::Integer` + (::String | nil) <: ::Integer + ::String <: ::Integer + ::Object <: ::Integer + ::BasicObject <: ::Integer code: Ruby::IncompatibleAssignment - file: b.rb diagnostics: diff --git a/smoke/block/test_expectations.yml b/smoke/block/test_expectations.yml index 9ad08293a..0d7e06b62 100644 --- a/smoke/block/test_expectations.yml +++ b/smoke/block/test_expectations.yml @@ -129,5 +129,5 @@ line: 11 character: 5 severity: ERROR - message: Type `(::Integer | ::String)` does not have method `foo` + message: Type `(::Integer | ::String | nil)` does not have method `foo` code: Ruby::NoMethod diff --git a/smoke/hash/test_expectations.yml b/smoke/hash/test_expectations.yml index 9a4334081..44f178939 100644 --- a/smoke/hash/test_expectations.yml +++ b/smoke/hash/test_expectations.yml @@ -48,7 +48,7 @@ line: 10 character: 37 severity: ERROR - message: Type `(::Integer | ::String)` does not have method `abcdefg` + message: Type `(::Integer | ::String | nil)` does not have method `abcdefg` code: Ruby::NoMethod - file: d.rb diagnostics: diff --git a/smoke/tsort/a.rb b/smoke/tsort/a.rb index ba3b7455c..83be62328 100644 --- a/smoke/tsort/a.rb +++ b/smoke/tsort/a.rb @@ -6,7 +6,7 @@ # @type var each_node: ^() { (Integer) -> void } -> void each_node = -> (&b) { g.each_key(&b) } # @type var each_child: ^(Integer) { (Integer) -> void } -> void -each_child = -> (n, &b) { g[n].each(&b) } +each_child = -> (n, &b) { g[n]&.each(&b) } # @type var xs: Array[Integer] xs = TSort.tsort(each_node, each_child)