bolt 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/bolt/cli.rb +31 -21
- data/lib/bolt/config.rb +1 -0
- data/lib/bolt/error.rb +28 -0
- data/lib/bolt/executor.rb +10 -6
- data/lib/bolt/node.rb +7 -5
- data/lib/bolt/node/errors.rb +25 -3
- data/lib/bolt/node/orch.rb +7 -16
- data/lib/bolt/node/output.rb +17 -0
- data/lib/bolt/node/ssh.rb +101 -44
- data/lib/bolt/node/winrm.rb +86 -40
- data/lib/bolt/outputter/human.rb +65 -8
- data/lib/bolt/outputter/json.rb +8 -1
- data/lib/bolt/result.rb +74 -124
- data/lib/bolt/version.rb +1 -1
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/file_upload.rb +9 -7
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/run_command.rb +8 -9
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/run_plan.rb +8 -12
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/run_script.rb +12 -8
- data/{vendored/puppet → modules/boltlib}/lib/puppet/functions/run_task.rb +10 -10
- data/vendored/puppet/lib/puppet/agent.rb +1 -1
- data/vendored/puppet/lib/puppet/application/lookup.rb +1 -3
- data/vendored/puppet/lib/puppet/configurer.rb +2 -3
- data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +25 -7
- data/vendored/puppet/lib/puppet/defaults.rb +9 -1
- data/vendored/puppet/lib/puppet/face/epp.rb +4 -2
- data/vendored/puppet/lib/puppet/face/module/build.rb +1 -1
- data/vendored/puppet/lib/puppet/face/module/list.rb +5 -16
- data/vendored/puppet/lib/puppet/face/module/uninstall.rb +14 -3
- data/vendored/puppet/lib/puppet/face/plugin.rb +1 -3
- data/vendored/puppet/lib/puppet/forge/errors.rb +17 -7
- data/vendored/puppet/lib/puppet/functions.rb +8 -6
- data/vendored/puppet/lib/puppet/functions/each.rb +10 -4
- data/vendored/puppet/lib/puppet/functions/lookup.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/map.rb +12 -2
- data/vendored/puppet/lib/puppet/functions/slice.rb +2 -3
- data/vendored/puppet/lib/puppet/graph/simple_graph.rb +9 -5
- data/vendored/puppet/lib/puppet/interface.rb +1 -0
- data/vendored/puppet/lib/puppet/module_tool/errors/installer.rb +27 -17
- data/vendored/puppet/lib/puppet/module_tool/errors/shared.rb +143 -63
- data/vendored/puppet/lib/puppet/module_tool/errors/uninstaller.rb +37 -14
- data/vendored/puppet/lib/puppet/module_tool/errors/upgrader.rb +30 -18
- data/vendored/puppet/lib/puppet/network/auth_config_parser.rb +8 -8
- data/vendored/puppet/lib/puppet/network/http/error.rb +7 -7
- data/vendored/puppet/lib/puppet/network/http/rack.rb +2 -2
- data/vendored/puppet/lib/puppet/network/http/webrick.rb +1 -1
- data/vendored/puppet/lib/puppet/node.rb +10 -0
- data/vendored/puppet/lib/puppet/node/facts.rb +9 -0
- data/vendored/puppet/lib/puppet/parameter/value_collection.rb +16 -6
- data/vendored/puppet/lib/puppet/parser/resource.rb +103 -31
- data/vendored/puppet/lib/puppet/pops/evaluator/access_operator.rb +13 -0
- data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +22 -6
- data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +13 -4
- data/vendored/puppet/lib/puppet/pops/model/ast_transformer.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +527 -529
- data/vendored/puppet/lib/puppet/pops/serialization/abstract_reader.rb +4 -0
- data/vendored/puppet/lib/puppet/pops/serialization/abstract_writer.rb +6 -0
- data/vendored/puppet/lib/puppet/pops/serialization/extension.rb +1 -0
- data/vendored/puppet/lib/puppet/pops/serialization/serializer.rb +2 -1
- data/vendored/puppet/lib/puppet/pops/types/execution_result.rb +8 -0
- data/vendored/puppet/lib/puppet/pops/types/iterable.rb +2 -0
- data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +3 -0
- data/vendored/puppet/lib/puppet/pops/types/p_object_type_extension.rb +6 -0
- data/vendored/puppet/lib/puppet/pops/types/p_uri_type.rb +191 -0
- data/vendored/puppet/lib/puppet/pops/types/string_converter.rb +17 -0
- data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +5 -0
- data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +7 -0
- data/vendored/puppet/lib/puppet/pops/types/type_formatter.rb +16 -18
- data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +15 -5
- data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +6 -0
- data/vendored/puppet/lib/puppet/pops/types/type_with_members.rb +43 -0
- data/vendored/puppet/lib/puppet/pops/types/types.rb +3 -0
- data/vendored/puppet/lib/puppet/provider/package/gem.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/nim.rb +7 -8
- data/vendored/puppet/lib/puppet/provider/package/opkg.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/package/pkg.rb +6 -4
- data/vendored/puppet/lib/puppet/provider/package/pkgutil.rb +3 -3
- data/vendored/puppet/lib/puppet/provider/service/init.rb +1 -1
- data/vendored/puppet/lib/puppet/syntax_checkers/base64.rb +5 -6
- data/vendored/puppet/lib/puppet/transaction.rb +1 -1
- data/vendored/puppet/lib/puppet/type.rb +1 -9
- data/vendored/puppet/lib/puppet/type/schedule.rb +1 -1
- data/vendored/puppet/lib/puppet/util/log.rb +2 -3
- data/vendored/puppet/lib/puppet/util/plist.rb +1 -1
- data/vendored/puppet/lib/puppet/util/reference.rb +2 -3
- data/vendored/puppet/lib/puppet_pal.rb +326 -53
- metadata +28 -12
- data/lib/bolt/node/result.rb +0 -115
- data/vendored/puppet/lib/puppet/configurer/downloader_factory.rb +0 -44
@@ -170,6 +170,10 @@ class AbstractReader
|
|
170
170
|
# are written as binary data.
|
171
171
|
read_payload(data) { |ep| Types::PBinaryType::Binary.new(ep.read) }
|
172
172
|
end
|
173
|
+
|
174
|
+
register_type(Extension::URI) do |data|
|
175
|
+
read_payload(data) { |ep| URI(ep.read) }
|
176
|
+
end
|
173
177
|
end
|
174
178
|
end
|
175
179
|
end
|
@@ -201,6 +201,12 @@ class AbstractWriter
|
|
201
201
|
build_payload { |ep| ep.write(o.to_s) }
|
202
202
|
end
|
203
203
|
end
|
204
|
+
|
205
|
+
URI.scheme_list.values.each do |uri_class|
|
206
|
+
register_type(Extension::URI, uri_class) do |o|
|
207
|
+
build_payload { |ep| ep.write(o.to_s) }
|
208
|
+
end
|
209
|
+
end
|
204
210
|
end
|
205
211
|
|
206
212
|
def to_s
|
@@ -108,7 +108,8 @@ module Serialization
|
|
108
108
|
value.instance_of?(SemanticPuppet::VersionRange),
|
109
109
|
value.instance_of?(Time::Timestamp),
|
110
110
|
value.instance_of?(Time::Timespan),
|
111
|
-
value.instance_of?(Types::PBinaryType::Binary)
|
111
|
+
value.instance_of?(Types::PBinaryType::Binary),
|
112
|
+
value.is_a?(URI)
|
112
113
|
push_written(value)
|
113
114
|
@writer.write(value)
|
114
115
|
when value.instance_of?(Array)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'ruby_generator'
|
2
|
+
require_relative 'type_with_members'
|
2
3
|
|
3
4
|
module Puppet::Pops
|
4
5
|
module Types
|
@@ -17,6 +18,7 @@ KEY_TYPE_PARAMETERS = 'type_parameters'.freeze
|
|
17
18
|
|
18
19
|
# @api public
|
19
20
|
class PObjectType < PMetaType
|
21
|
+
include TypeWithMembers
|
20
22
|
|
21
23
|
ATTRIBUTE_KIND_CONSTANT = 'constant'.freeze
|
22
24
|
ATTRIBUTE_KIND_DERIVED = 'derived'.freeze
|
@@ -89,6 +91,7 @@ class PObjectType < PMetaType
|
|
89
91
|
# @api public
|
90
92
|
class PAnnotatedMember
|
91
93
|
include Annotatable
|
94
|
+
include InvocableMember
|
92
95
|
|
93
96
|
# @return [PObjectType] the object type containing this member
|
94
97
|
# @api public
|
@@ -7,6 +7,8 @@ module Types
|
|
7
7
|
#
|
8
8
|
# @api public
|
9
9
|
class PObjectTypeExtension < PAnyType
|
10
|
+
include TypeWithMembers
|
11
|
+
|
10
12
|
def self.register_ptype(loader, ir)
|
11
13
|
create_ptype(loader, ir, 'AnyType',
|
12
14
|
'base_type' => {
|
@@ -26,6 +28,10 @@ class PObjectTypeExtension < PAnyType
|
|
26
28
|
impl_class.new(base_type, init_parameters)
|
27
29
|
end
|
28
30
|
|
31
|
+
def [](name)
|
32
|
+
@base_type[name]
|
33
|
+
end
|
34
|
+
|
29
35
|
# @api private
|
30
36
|
def initialize(base_type, init_parameters)
|
31
37
|
pts = base_type.type_parameters(true)
|
@@ -0,0 +1,191 @@
|
|
1
|
+
module Puppet::Pops
|
2
|
+
module Types
|
3
|
+
class PURIType < PAnyType
|
4
|
+
|
5
|
+
# Tell evaluator that an members of instances of this type can be invoked using dot notation
|
6
|
+
include TypeWithMembers
|
7
|
+
|
8
|
+
SCHEME = 'scheme'.freeze
|
9
|
+
USERINFO = 'userinfo'.freeze
|
10
|
+
HOST = 'host'.freeze
|
11
|
+
PORT = 'port'.freeze
|
12
|
+
PATH = 'path'.freeze
|
13
|
+
QUERY = 'query'.freeze
|
14
|
+
FRAGMENT = 'fragment'.freeze
|
15
|
+
OPAQUE = 'opaque'.freeze
|
16
|
+
|
17
|
+
URI_MEMBERS = {
|
18
|
+
SCHEME => AttrReader.new(SCHEME),
|
19
|
+
USERINFO => AttrReader.new(USERINFO),
|
20
|
+
HOST => AttrReader.new(HOST),
|
21
|
+
PORT => AttrReader.new(PORT),
|
22
|
+
PATH => AttrReader.new(PATH),
|
23
|
+
QUERY => AttrReader.new(QUERY),
|
24
|
+
FRAGMENT => AttrReader.new(FRAGMENT),
|
25
|
+
OPAQUE => AttrReader.new(OPAQUE),
|
26
|
+
}
|
27
|
+
|
28
|
+
TYPE_URI_INIT_HASH = TypeFactory.struct(
|
29
|
+
TypeFactory.optional(SCHEME) => PStringType::NON_EMPTY,
|
30
|
+
TypeFactory.optional(USERINFO) => PStringType::NON_EMPTY,
|
31
|
+
TypeFactory.optional(HOST) => PStringType::NON_EMPTY,
|
32
|
+
TypeFactory.optional(PORT) => PIntegerType.new(0),
|
33
|
+
TypeFactory.optional(PATH) => PStringType::NON_EMPTY,
|
34
|
+
TypeFactory.optional(QUERY) => PStringType::NON_EMPTY,
|
35
|
+
TypeFactory.optional(FRAGMENT) => PStringType::NON_EMPTY,
|
36
|
+
TypeFactory.optional(OPAQUE) => PStringType::NON_EMPTY,
|
37
|
+
)
|
38
|
+
|
39
|
+
TYPE_STRING_PARAM = TypeFactory.optional(PVariantType.new([
|
40
|
+
PStringType::NON_EMPTY,
|
41
|
+
PRegexpType::DEFAULT,
|
42
|
+
TypeFactory.type_type(PPatternType::DEFAULT),
|
43
|
+
TypeFactory.type_type(PEnumType::DEFAULT),
|
44
|
+
TypeFactory.type_type(PNotUndefType::DEFAULT),
|
45
|
+
TypeFactory.type_type(PUndefType::DEFAULT),
|
46
|
+
]))
|
47
|
+
|
48
|
+
TYPE_INTEGER_PARAM = TypeFactory.optional(PVariantType.new([
|
49
|
+
PIntegerType.new(0),
|
50
|
+
TypeFactory.type_type(PNotUndefType::DEFAULT),
|
51
|
+
TypeFactory.type_type(PUndefType::DEFAULT),
|
52
|
+
]))
|
53
|
+
|
54
|
+
TYPE_URI_PARAM_HASH_TYPE = TypeFactory.struct(
|
55
|
+
TypeFactory.optional(SCHEME) => TYPE_STRING_PARAM,
|
56
|
+
TypeFactory.optional(USERINFO) => TYPE_STRING_PARAM,
|
57
|
+
TypeFactory.optional(HOST) => TYPE_STRING_PARAM,
|
58
|
+
TypeFactory.optional(PORT) => TYPE_INTEGER_PARAM,
|
59
|
+
TypeFactory.optional(PATH) => TYPE_STRING_PARAM,
|
60
|
+
TypeFactory.optional(QUERY) => TYPE_STRING_PARAM,
|
61
|
+
TypeFactory.optional(FRAGMENT) => TYPE_STRING_PARAM,
|
62
|
+
TypeFactory.optional(OPAQUE) => TYPE_STRING_PARAM,
|
63
|
+
)
|
64
|
+
|
65
|
+
TYPE_URI_PARAM_TYPE = PVariantType.new([PStringType::NON_EMPTY, TYPE_URI_PARAM_HASH_TYPE])
|
66
|
+
|
67
|
+
def self.register_ptype(loader, ir)
|
68
|
+
create_ptype(loader, ir, 'AnyType',
|
69
|
+
{
|
70
|
+
'parameters' => { KEY_TYPE => TypeFactory.optional(TYPE_URI_PARAM_TYPE), KEY_VALUE => nil }
|
71
|
+
}
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.new_function(type)
|
76
|
+
@new_function ||= Puppet::Functions.create_loaded_function(:new_error, type.loader) do
|
77
|
+
dispatch :create do
|
78
|
+
param 'String[1]', :uri
|
79
|
+
end
|
80
|
+
|
81
|
+
dispatch :from_hash do
|
82
|
+
param TYPE_URI_INIT_HASH, :hash
|
83
|
+
end
|
84
|
+
|
85
|
+
def create(uri)
|
86
|
+
URI.parse(uri)
|
87
|
+
end
|
88
|
+
|
89
|
+
def from_hash(init_hash)
|
90
|
+
sym_hash = {}
|
91
|
+
init_hash.each_pair { |k, v| sym_hash[k.to_sym] = v }
|
92
|
+
scheme = sym_hash[:scheme]
|
93
|
+
scheme_class = scheme.nil? ? URI::Generic : (URI.scheme_list[scheme.upcase] || URI::Generic)
|
94
|
+
scheme_class.build(sym_hash)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
attr_reader :parameters
|
100
|
+
|
101
|
+
def initialize(parameters = nil)
|
102
|
+
if parameters.is_a?(String)
|
103
|
+
parameters = TypeAsserter.assert_instance_of('URI-Type parameter', Pcore::TYPE_URI, parameters, true)
|
104
|
+
@parameters = uri_to_hash(URI.parse(parameters))
|
105
|
+
elsif parameters.is_a?(URI)
|
106
|
+
@parameters = uri_to_hash(parameters)
|
107
|
+
elsif parameters.is_a?(Hash)
|
108
|
+
params = TypeAsserter.assert_instance_of('URI-Type parameter', TYPE_URI_PARAM_TYPE, parameters, true)
|
109
|
+
@parameters = params.empty? ? nil : params
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def eql?(o)
|
114
|
+
self.class == o.class && @parameters == o.parameters
|
115
|
+
end
|
116
|
+
|
117
|
+
def ==(o)
|
118
|
+
eql?(o)
|
119
|
+
end
|
120
|
+
|
121
|
+
def [](key)
|
122
|
+
URI_MEMBERS[key]
|
123
|
+
end
|
124
|
+
|
125
|
+
def generalize
|
126
|
+
DEFAULT
|
127
|
+
end
|
128
|
+
|
129
|
+
def hash
|
130
|
+
self.class.hash ^ @parameters.hash
|
131
|
+
end
|
132
|
+
|
133
|
+
def instance?(o, guard = nil)
|
134
|
+
return false unless o.is_a?(URI)
|
135
|
+
return true if @parameters.nil?
|
136
|
+
|
137
|
+
eval = Parser::EvaluatingParser.singleton.evaluator
|
138
|
+
@parameters.keys.all? { |pn| eval.match?(o.send(pn), @parameters[pn]) }
|
139
|
+
end
|
140
|
+
|
141
|
+
def roundtrip_with_string?
|
142
|
+
true
|
143
|
+
end
|
144
|
+
|
145
|
+
def _pcore_init_hash
|
146
|
+
@parameters == nil? ? EMPTY_HASH : { 'parameters' => @parameters }
|
147
|
+
end
|
148
|
+
|
149
|
+
protected
|
150
|
+
|
151
|
+
def _assignable?(o, guard = nil)
|
152
|
+
return false unless o.class == self.class
|
153
|
+
return true if @parameters.nil?
|
154
|
+
params = @parameters
|
155
|
+
o_params = o.parameters || EMPTY_HASH
|
156
|
+
|
157
|
+
eval = Parser::EvaluatingParser.singleton.evaluator
|
158
|
+
@parameters.keys.all? do |pn|
|
159
|
+
if o_params.include?(pn)
|
160
|
+
a = o_params[pn]
|
161
|
+
b = @parameters[pn]
|
162
|
+
eval.match?(a, b) || a.is_a?(PAnyType) && b.is_a?(PAnyType) && b.assignable?(a)
|
163
|
+
else
|
164
|
+
false
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
private
|
170
|
+
|
171
|
+
def uri_to_hash(uri)
|
172
|
+
result = {}
|
173
|
+
scheme = uri.scheme
|
174
|
+
unless scheme.nil?
|
175
|
+
scheme = scheme.downcase
|
176
|
+
result[SCHEME] = scheme
|
177
|
+
end
|
178
|
+
result[USERINFO] = uri.userinfo unless uri.userinfo.nil?
|
179
|
+
result[HOST] = uri.host.downcase unless uri.host.nil?
|
180
|
+
result[PORT] = uri.port.to_s unless uri.port.nil? || uri.port == 80 && 'http' == scheme || uri.port == 443 && 'https' == scheme
|
181
|
+
result[PATH] = uri.path unless uri.path.nil? || uri.path.empty?
|
182
|
+
result[QUERY] = uri.query unless uri.query.nil?
|
183
|
+
result[FRAGMENT] = uri.fragment unless uri.fragment.nil?
|
184
|
+
result[OPAQUE] = uri.opaque unless uri.opaque.nil?
|
185
|
+
result.empty? ? nil : result
|
186
|
+
end
|
187
|
+
|
188
|
+
DEFAULT = PURIType.new(nil)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -1089,6 +1089,23 @@ class StringConverter
|
|
1089
1089
|
end
|
1090
1090
|
end
|
1091
1091
|
|
1092
|
+
# @api private
|
1093
|
+
def string_PURIType(val_type, val, format_map, indentation)
|
1094
|
+
f = get_format(val_type, format_map)
|
1095
|
+
case f.format
|
1096
|
+
when :p
|
1097
|
+
fmt = TypeFormatter.singleton
|
1098
|
+
indentation = indentation.indenting(f.alt? || indentation.is_indenting?)
|
1099
|
+
fmt = fmt.indented(indentation.level, 2) if indentation.is_indenting?
|
1100
|
+
fmt.string(val)
|
1101
|
+
when :s
|
1102
|
+
str_val = val.to_s
|
1103
|
+
Kernel.format(f.orig_fmt, f.alt? ? puppet_quote(str_val) : str_val)
|
1104
|
+
else
|
1105
|
+
raise FormatError.new('URI', f.format, 'sp')
|
1106
|
+
end
|
1107
|
+
end
|
1108
|
+
|
1092
1109
|
# Maps the inferred type of o to a formatting rule
|
1093
1110
|
def get_format(val_t, format_options)
|
1094
1111
|
fmt = format_options.find {|k,_| k.assignable?(val_t) }
|
@@ -528,6 +528,13 @@ module TypeFactory
|
|
528
528
|
@target_t ||= TypeParser.singleton.parse('Target')
|
529
529
|
end
|
530
530
|
|
531
|
+
# Produces a type for URI[String or Hash]
|
532
|
+
# @api public
|
533
|
+
#
|
534
|
+
def self.uri(string_uri_or_hash = nil)
|
535
|
+
string_uri_or_hash.nil? ? PURIType::DEFAULT : PURIType.new(string_uri_or_hash)
|
536
|
+
end
|
537
|
+
|
531
538
|
# Produce a type corresponding to the class of given unless given is a
|
532
539
|
# String, Class or a PAnyType. When a String is given this is taken as
|
533
540
|
# a classname.
|
@@ -330,24 +330,6 @@ class TypeFormatter
|
|
330
330
|
append_array('Pattern', t.patterns.empty?) { append_strings(t.patterns.map(&:regexp)) }
|
331
331
|
end
|
332
332
|
|
333
|
-
def append_error_param(ep)
|
334
|
-
case ep
|
335
|
-
when PStringType
|
336
|
-
if ep.value.nil?
|
337
|
-
append_string(ep)
|
338
|
-
else
|
339
|
-
append_string(ep.value)
|
340
|
-
end
|
341
|
-
when PPatternType
|
342
|
-
if ep.patterns.size != 1
|
343
|
-
append_string(ep)
|
344
|
-
else
|
345
|
-
append_string(ep.patterns[0].regexp)
|
346
|
-
end
|
347
|
-
else
|
348
|
-
append_string(ep)
|
349
|
-
end
|
350
|
-
end
|
351
333
|
|
352
334
|
# @api private
|
353
335
|
def string_PCollectionType(t)
|
@@ -366,6 +348,22 @@ class TypeFormatter
|
|
366
348
|
@bld << ')'
|
367
349
|
end
|
368
350
|
|
351
|
+
# @api private
|
352
|
+
def string_PURIType(t)
|
353
|
+
append_array('URI', t.parameters.nil?) { append_string(t._pcore_init_hash['parameters']) }
|
354
|
+
end
|
355
|
+
|
356
|
+
def string_URI(t)
|
357
|
+
@bld << 'URI('
|
358
|
+
if @indent
|
359
|
+
append_indented_string(t.to_s, @indent, @indent_width, true)
|
360
|
+
@bld.chomp!
|
361
|
+
else
|
362
|
+
append_string(t.to_s)
|
363
|
+
end
|
364
|
+
@bld << ')'
|
365
|
+
end
|
366
|
+
|
369
367
|
# @api private
|
370
368
|
def string_PUnitType(_)
|
371
369
|
@bld << 'Unit'
|
@@ -286,8 +286,8 @@ module Types
|
|
286
286
|
a = detailed_actual_to_s(e, a)
|
287
287
|
e = e.map { |t| t.to_alias_expanded_s }
|
288
288
|
else
|
289
|
-
e = e.map { |t| t
|
290
|
-
a = a
|
289
|
+
e = e.map { |t| short_name(t) }.uniq
|
290
|
+
a = short_name(a)
|
291
291
|
end
|
292
292
|
e.insert(0, 'Undef') if optional
|
293
293
|
case e.size
|
@@ -305,8 +305,8 @@ module Types
|
|
305
305
|
a = detailed_actual_to_s(e, a)
|
306
306
|
e = e.to_alias_expanded_s
|
307
307
|
else
|
308
|
-
e = e
|
309
|
-
a = a
|
308
|
+
e = short_name(e)
|
309
|
+
a = short_name(a)
|
310
310
|
end
|
311
311
|
if optional
|
312
312
|
e = "Undef or #{e}"
|
@@ -326,6 +326,16 @@ module Types
|
|
326
326
|
|
327
327
|
private
|
328
328
|
|
329
|
+
def short_name(t)
|
330
|
+
# Ensure that Optional, NotUndef, Sensitive, and Type are reported with included
|
331
|
+
# type parameter.
|
332
|
+
if t.is_a?(PTypeWithContainedType) && !(t.type.nil? || t.type.class == PAnyType)
|
333
|
+
"#{t.name}[#{t.type.name}]"
|
334
|
+
else
|
335
|
+
t.name.nil? ? t.simple_name : t.name
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
329
339
|
# Answers the question if `e` is a specialized type of `a`
|
330
340
|
# @param e [PAnyType] the expected type
|
331
341
|
# @param a [PAnyType] the actual type
|
@@ -430,7 +440,7 @@ module Types
|
|
430
440
|
|
431
441
|
def actual_string
|
432
442
|
a = actual
|
433
|
-
a.is_a?(PStringType) && !a.value.nil? ? "'#{a.value}'" : a
|
443
|
+
a.is_a?(PStringType) && !a.value.nil? ? "'#{a.value}'" : short_name(a)
|
434
444
|
end
|
435
445
|
end
|
436
446
|
|