puppet 5.3.2-x64-mingw32 → 5.3.3-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +5 -1
  3. data/Rakefile +9 -4
  4. data/lib/puppet.rb +4 -5
  5. data/lib/puppet/external/nagios/grammar.ry +1 -1
  6. data/lib/puppet/external/nagios/parser.rb +1 -1
  7. data/lib/puppet/forge.rb +9 -3
  8. data/lib/puppet/forge/repository.rb +1 -1
  9. data/lib/puppet/gettext/config.rb +86 -28
  10. data/lib/puppet/graph/relationship_graph.rb +6 -0
  11. data/lib/puppet/indirector/catalog/compiler.rb +25 -5
  12. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  13. data/lib/puppet/module.rb +9 -18
  14. data/lib/puppet/pops/types/p_binary_type.rb +9 -2
  15. data/lib/puppet/pops/types/p_object_type.rb +9 -3
  16. data/lib/puppet/pops/types/ruby_generator.rb +65 -24
  17. data/lib/puppet/provider/service/base.rb +21 -8
  18. data/lib/puppet/provider/zfs/zfs.rb +5 -1
  19. data/lib/puppet/util/windows/file.rb +35 -4
  20. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +1 -1
  21. data/lib/puppet/version.rb +1 -1
  22. data/locales/ja/puppet.po +92 -64
  23. data/locales/puppet.pot +28 -24
  24. data/spec/fixtures/unit/provider/service/base/ps_ef.mixed_encoding +3 -0
  25. data/spec/integration/file_bucket/file_spec.rb +20 -5
  26. data/spec/integration/transaction_spec.rb +35 -2
  27. data/spec/unit/forge/forge_spec.rb +2 -2
  28. data/spec/unit/forge_spec.rb +105 -0
  29. data/spec/unit/gettext_config_spec.rb +4 -4
  30. data/spec/unit/graph/relationship_graph_spec.rb +15 -0
  31. data/spec/unit/module_spec.rb +8 -13
  32. data/spec/unit/pops/types/ruby_generator_spec.rb +192 -0
  33. data/spec/unit/provider/service/base_spec.rb +20 -0
  34. data/spec/unit/provider/zfs/zfs_spec.rb +7 -1
  35. data/spec/unit/type/nagios_spec.rb +21 -1
  36. metadata +3374 -3394
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a45a23d49beb5af39295df48eddd802672007923
4
+ data.tar.gz: d6985616a65ccc878d116917204f328b6d4cc37b
5
+ SHA512:
6
+ metadata.gz: 37d04c9629bbb691d345db14051d8086d3dd361787309fe5a83bcf03c2453356a8d9645046117704b517316ce8110a6267eca4b4a5c2f3eed723a2ef543e43df
7
+ data.tar.gz: 30ca3b6c134a4fd8a630c60834f6fa874b71cf5db84294966e609fcec6ea5c6457f92ae7a4c85a76ae0d9ba028c2014287eeadd0fdf99adfab2331aa505d1aa1
data/Gemfile CHANGED
@@ -53,7 +53,11 @@ group(:development, :test) do
53
53
  gem "multi_json", "1.7.7", :require => false, :platforms => [:ruby, :jruby]
54
54
  gem "json-schema", "2.1.1", :require => false, :platforms => [:ruby, :jruby]
55
55
 
56
- gem "rubocop", "~> 0.39.0", :platforms => [:ruby]
56
+ if RUBY_VERSION >= '2.0'
57
+ # pin rubocop as 0.50 requires a higher version of the rainbow gem (see below)
58
+ gem 'rubocop', '~> 0.49.1', :platforms => [:ruby]
59
+ end
60
+
57
61
  # pin rainbow gem as 2.2.1 requires rubygems 2.6.9+ and (donotwant)
58
62
  gem "rainbow", "< 2.2.1", :platforms => [:ruby]
59
63
 
data/Rakefile CHANGED
@@ -69,10 +69,15 @@ end
69
69
 
70
70
  desc 'run static analysis with rubocop'
71
71
  task(:rubocop) do
72
- require 'rubocop'
73
- cli = RuboCop::CLI.new
74
- exit_code = cli.run(%w(--display-cop-names --format simple))
75
- raise "RuboCop detected offenses" if exit_code != 0
72
+ if RUBY_VERSION < '2.0'
73
+ puts 'rubocop tests require Ruby 2.0 or higher'
74
+ puts 'skipping rubocop'
75
+ else
76
+ require 'rubocop'
77
+ cli = RuboCop::CLI.new
78
+ exit_code = cli.run(%w(--display-cop-names --format simple))
79
+ raise "RuboCop detected offenses" if exit_code != 0
80
+ end
76
81
  end
77
82
 
78
83
  desc "verify that commit messages match CONTRIBUTING.md requirements"
@@ -42,11 +42,10 @@ module Puppet
42
42
  require 'puppet/environments'
43
43
 
44
44
  class << self
45
- gettext_config_file = Puppet::GettextConfig.puppet_locale_path
46
- unless Puppet::GettextConfig.initialize(gettext_config_file, Puppet::GettextConfig.translation_mode(gettext_config_file))
47
- # Stub out gettext's `_` and `n_()` methods, which attempt to load translations,
48
- # with versions that do nothing
49
- require 'puppet/gettext/stubs'
45
+ Puppet::GettextConfig.create_text_domain('production')
46
+ locale_dir = Puppet::GettextConfig.puppet_locale_path
47
+ if Puppet::GettextConfig.load_translations('puppet', locale_dir, Puppet::GettextConfig.translation_mode(locale_dir))
48
+ Puppet::GettextConfig.set_locale(Locale.current.language)
50
49
  end
51
50
 
52
51
  include Puppet::Util
@@ -52,7 +52,7 @@ require 'strscan'
52
52
  class ::Nagios::Parser::SyntaxError < RuntimeError; end
53
53
 
54
54
  def parse(src)
55
- if src.respond_to?("force_encoding") then
55
+ if (RUBY_VERSION < '2.1.0') && src.respond_to?("force_encoding") then
56
56
  src.force_encoding("ASCII-8BIT")
57
57
  end
58
58
  @ss = StringScanner.new(src)
@@ -14,7 +14,7 @@ require 'strscan'
14
14
  class ::Nagios::Parser::SyntaxError < RuntimeError; end
15
15
 
16
16
  def parse(src)
17
- if src.respond_to?("force_encoding") then
17
+ if (RUBY_VERSION < '2.1.0') && src.respond_to?("force_encoding") then
18
18
  src.force_encoding("ASCII-8BIT")
19
19
  end
20
20
  @ss = StringScanner.new(src)
@@ -65,7 +65,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
65
65
 
66
66
  if response.code == '200'
67
67
  result = JSON.parse(response.body)
68
- uri = result['pagination']['next']
68
+ uri = decode_uri(result['pagination']['next'])
69
69
  matches.concat result['results']
70
70
  else
71
71
  raise ResponseError.new(:uri => URI.parse(@host).merge(uri), :response => response)
@@ -90,7 +90,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
90
90
  # @see SemanticPuppet::Dependency::Source#fetch
91
91
  def fetch(input)
92
92
  name = input.tr('/', '-')
93
- uri = "/v3/releases?module=#{name}"
93
+ uri = "/v3/releases?module=#{name}&sort_by=version"
94
94
  if Puppet[:module_groups]
95
95
  uri += "&module_groups=#{Puppet[:module_groups].gsub('+', ' ')}"
96
96
  end
@@ -107,7 +107,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
107
107
  end
108
108
 
109
109
  releases.concat(process(response['results']))
110
- uri = response['pagination']['next']
110
+ uri = decode_uri(response['pagination']['next'])
111
111
  end
112
112
 
113
113
  return releases
@@ -226,4 +226,10 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
226
226
 
227
227
  l.select { |r| r }
228
228
  end
229
+
230
+ def decode_uri(uri)
231
+ return if uri.nil?
232
+
233
+ URI.decode(uri.gsub('+', ' '))
234
+ end
229
235
  end
@@ -44,8 +44,8 @@ class Puppet::Forge
44
44
 
45
45
  # Return a Net::HTTPResponse read for this +path+.
46
46
  def make_http_request(path, io = nil)
47
- Puppet.debug "HTTP GET #{@host}#{path}"
48
47
  request = get_request_object(@uri.path.chomp('/')+path)
48
+ Puppet.debug "HTTP GET #{@host}#{request.path}"
49
49
  return read_response(request, io)
50
50
  end
51
51
 
@@ -10,19 +10,58 @@ module Puppet::GettextConfig
10
10
  # Used instead of features because we initialize gettext before features is available.
11
11
  # Stubbing gettext if unavailable is handled in puppet.rb.
12
12
  begin
13
- require 'gettext-setup'
13
+ require 'fast_gettext'
14
14
  require 'locale'
15
+
16
+ # Make translation methods (e.g. `_()` and `n_()`) available everywhere.
17
+ class ::Object
18
+ include FastGettext::Translation
19
+ end
20
+
15
21
  @gettext_loaded = true
16
22
  rescue LoadError
23
+ # Stub out gettext's `_` and `n_()` methods, which attempt to load translations,
24
+ # with versions that do nothing
25
+ require 'puppet/gettext/stubs'
17
26
  @gettext_loaded = false
18
27
  end
19
28
 
20
- # Whether we were able to require gettext-setup and locale
21
- # @return [Boolean] true if gettext-setup was successfully loaded
29
+ # @api private
30
+ # Whether we were able to require fast_gettext and locale
31
+ # @return [Boolean] true if translation gems were successfully loaded
22
32
  def self.gettext_loaded?
23
33
  @gettext_loaded
24
34
  end
25
35
 
36
+ # @api private
37
+ # Whether translations have been loaded for a given project
38
+ # @param project_name [String] the project whose translations we are querying
39
+ # @return [Boolean] true if translations have been loaded for the project
40
+ def self.translations_loaded?(project_name)
41
+ return false unless gettext_loaded?
42
+ if @loaded_repositories[project_name]
43
+ return true
44
+ else
45
+ return false
46
+ end
47
+ end
48
+
49
+ # @api private
50
+ # Creates a new empty text domain with the given name, replacing
51
+ # any existing domain with that name, then switches to using
52
+ # that domain. Also clears the cache of loaded translations.
53
+ # @param domain_name [String] the name of the domain to create
54
+ def self.create_text_domain(domain_name)
55
+ return unless gettext_loaded?
56
+ # Clear the cache of loaded translation repositories
57
+ @loaded_repositories = {}
58
+ FastGettext.add_text_domain(domain_name, type: :chain, chain: [])
59
+ #TODO remove this when we start managing domains per environment
60
+ FastGettext.default_text_domain = domain_name
61
+ FastGettext.text_domain = domain_name
62
+ end
63
+
64
+ # @api private
26
65
  # Search for puppet gettext config files
27
66
  # @return [String] path to the config, or nil if not found
28
67
  def self.puppet_locale_path
@@ -37,6 +76,7 @@ module Puppet::GettextConfig
37
76
  end
38
77
  end
39
78
 
79
+ # @api private
40
80
  # Determine which translation file format to use
41
81
  # @param conf_path [String] the path to the gettext config file
42
82
  # @return [Symbol] :mo if in a package structure, :po otherwise
@@ -48,44 +88,62 @@ module Puppet::GettextConfig
48
88
  end
49
89
  end
50
90
 
91
+ # @api private
51
92
  # Prevent future gettext initializations
52
93
  def self.disable_gettext
53
94
  @gettext_disabled = true
54
95
  end
55
96
 
56
- # Attempt to initialize the gettext-setup gem
57
- # @param path [String] to gettext config file
97
+ # @api private
98
+ # Attempt to load tranlstions for the given project.
99
+ # @param project_name [String] the project whose translations we want to load
100
+ # @param locale_dir [String] the path to the directory containing translations
58
101
  # @param file_format [Symbol] translation file format to use, either :po or :mo
59
102
  # @return true if initialization succeeded, false otherwise
60
- def self.initialize(conf_file_dir, file_format)
103
+ def self.load_translations(project_name, locale_dir, file_format)
61
104
  return false if @gettext_disabled || !@gettext_loaded
62
105
 
106
+ return false unless locale_dir && Puppet::FileSystem.exist?(locale_dir)
107
+
63
108
  unless file_format == :po || file_format == :mo
64
109
  raise Puppet::Error, "Unsupported translation file format #{file_format}; please use :po or :mo"
65
110
  end
66
111
 
67
- return false if conf_file_dir.nil?
68
-
69
- conf_file = File.join(conf_file_dir, "config.yaml")
70
- if Puppet::FileSystem.exist?(conf_file)
71
- if GettextSetup.method(:initialize).parameters.count == 1
72
- # For use with old gettext-setup gem versions, will load PO files only
73
- GettextSetup.initialize(conf_file_dir)
74
- else
75
- GettextSetup.initialize(conf_file_dir, :file_format => file_format)
76
- end
77
- # Only change this once.
78
- # Because negotiate_locales will only return a non-default locale if
79
- # the system locale matches a translation set actually available for the
80
- # given gettext project, we don't want this to get set back to default if
81
- # we load a module that doesn't have translations, but Puppet does have
82
- # translations for the user's locale.
83
- if FastGettext.locale == GettextSetup.default_locale
84
- FastGettext.locale = GettextSetup.negotiate_locale(Locale.current.language)
85
- end
86
- true
87
- else
88
- false
112
+ if project_name.nil? || project_name.empty?
113
+ raise Puppet::Error, "A project name must be specified in order to initialize translations."
89
114
  end
115
+
116
+ add_repository_to_domain(project_name, locale_dir, file_format)
117
+ return true
118
+ end
119
+
120
+ # @api private
121
+ # Add the translations for this project to the domain's repository chain
122
+ # chain for the currently selected text domain, if needed.
123
+ # @param project_name [String] the name of the project for which to load translations
124
+ # @param locale_dir [String] the path to the directory containing translations
125
+ # @param file_format [Symbol] the fomat of the translations files, :po or :mo
126
+ def self.add_repository_to_domain(project_name, locale_dir, file_format)
127
+ # check if we've already loaded these transltaions
128
+ current_chain = FastGettext.translation_repositories[FastGettext.text_domain].chain
129
+ return current_chain if @loaded_repositories[project_name]
130
+
131
+ repository = FastGettext::TranslationRepository.build(project_name,
132
+ path: locale_dir,
133
+ type: file_format,
134
+ ignore_fuzzy: false)
135
+ @loaded_repositories[project_name] = true
136
+ current_chain << repository
137
+ end
138
+
139
+ # @api private
140
+ # Sets the language in which to display strings.
141
+ # @param locale [String] the language portion of a locale string (e.g. "ja")
142
+ def self.set_locale(locale)
143
+ return if !gettext_loaded?
144
+ # make sure we're not using the `available_locales` machinery
145
+ FastGettext.default_available_locales = nil
146
+
147
+ FastGettext.default_locale = locale
90
148
  end
91
149
  end
@@ -247,6 +247,12 @@ class Puppet::Graph::RelationshipGraph < Puppet::Graph::SimpleGraph
247
247
  containers.each { |x|
248
248
  admissible[x] = whit_class.new(:name => "admissible_#{x.ref}", :catalog => catalog)
249
249
  completed[x] = whit_class.new(:name => "completed_#{x.ref}", :catalog => catalog)
250
+
251
+ # This copies the original container's tags over to the two anchor whits.
252
+ # Without this, tags are not propagated to the container's resources.
253
+ admissible[x].set_tags(x)
254
+ completed[x].set_tags(x)
255
+
250
256
  priority = @prioritizer.priority_of(x)
251
257
  add_vertex(admissible[x], priority)
252
258
  add_vertex(completed[x], priority)
@@ -129,10 +129,13 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
129
129
  def inlineable?(resource, sources)
130
130
  case
131
131
  when resource[:ensure] == 'absent'
132
+ #TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining)
132
133
  return Puppet::Util::Profiler.profile(_("Not inlining absent resource"), [:compiler, :static_compile_inlining, :skipped_file_metadata, :absent]) { false }
133
134
  when sources.empty?
135
+ #TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining)
134
136
  return Puppet::Util::Profiler.profile(_("Not inlining resource without sources"), [:compiler, :static_compile_inlining, :skipped_file_metadata, :no_sources]) { false }
135
137
  when (not (sources.all? {|source| source =~ /^puppet:/}))
138
+ #TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining)
136
139
  return Puppet::Util::Profiler.profile(_("Not inlining unsupported source scheme"), [:compiler, :static_compile_inlining, :skipped_file_metadata, :unsupported_scheme]) { false }
137
140
  else
138
141
  return true
@@ -154,11 +157,13 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
154
157
  # Helper method to log file resources that could not be inlined because they
155
158
  # fall outside of an environment.
156
159
  def log_file_outside_environment
160
+ #TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining)
157
161
  Puppet::Util::Profiler.profile(_("Not inlining file outside environment"), [:compiler, :static_compile_inlining, :skipped_file_metadata, :file_outside_environment]) { true }
158
162
  end
159
163
 
160
164
  # Helper method to log file resources that were successfully inlined.
161
165
  def log_metadata_inlining
166
+ #TRANSLATORS Inlining refers to adding additional metadata
162
167
  Puppet::Util::Profiler.profile(_("Inlining file metadata"), [:compiler, :static_compile_inlining, :inlined_file_metadata]) { true }
163
168
  end
164
169
 
@@ -270,9 +275,19 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
270
275
  raise Puppet::Error, _("Unable to find a common checksum type between agent '%{agent_type}' and master '%{master_type}'.") % { agent_type: options[:checksum_type], master_type: known_checksum_types } unless checksum_type
271
276
  end
272
277
 
273
- str = _("Compiled %s for ") % (checksum_type ? _('static catalog') : _('catalog'))
274
- str += node.name
275
- str += _(" in environment %{env}") % { env: node.environment } if node.environment
278
+ str = if checksum_type
279
+ if node.environment
280
+ _("Compiled static catalog for %{node} in environment %{environment}") % { node: node.name, environment: node.environment }
281
+ else
282
+ _("Compiled static catalog for %{node}") % { node: node.name }
283
+ end
284
+ else
285
+ if node.environment
286
+ _("Compiled catalog for %{node} in environment %{environment}") % { node: node.name, environment: node.environment }
287
+ else
288
+ _("Compiled catalog for %{node}") % { node: node.name }
289
+ end
290
+ end
276
291
  config = nil
277
292
 
278
293
  benchmark(:notice, str) do
@@ -288,8 +303,13 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
288
303
  end
289
304
 
290
305
  if checksum_type && config.is_a?(model)
291
- str = _("Inlined resource metadata into static catalog for %{node}") % { node: node.name }
292
- str += _(" in environment %{env}") % { env: node.environment } if node.environment
306
+ str = if node.environment
307
+ #TRANSLATORS Inlined refers to adding additional metadata
308
+ _("Inlined resource metadata into static catalog for %{node} in environment %{environment}") % { node: node.name, environment: node.environment }
309
+ else
310
+ #TRANSLATORS Inlined refers to adding additional metadata
311
+ _("Inlined resource metadata into static catalog for %{node}") % { node: node.name }
312
+ end
293
313
  benchmark(:notice, str) do
294
314
  Puppet::Util::Profiler.profile(str, [:compiler, :static_compile_postprocessing, node.environment, node.name]) do
295
315
  inline_metadata(config, checksum_type)
@@ -219,7 +219,7 @@ module Puppet::FileBucketFile
219
219
  # and content as that in the bucket_file
220
220
  # @api private
221
221
  def verify_identical_file(contents_file, bucket_file)
222
- (bucket_file.size == Puppet::FileSystem.size(contents_file)) &&
222
+ (bucket_file.to_binary.bytesize == Puppet::FileSystem.size(contents_file)) &&
223
223
  (bucket_file.stream() {|s| Puppet::FileSystem.compare_stream(contents_file, s) })
224
224
  end
225
225
 
@@ -423,33 +423,24 @@ class Puppet::Module
423
423
  end
424
424
 
425
425
  def initialize_i18n
426
- module_name = @forge_name.gsub("/","-") if @forge_name
427
- return if module_name.nil? || i18n_initialized?(module_name)
426
+ # this name takes the form "namespace-module", and should match the name of
427
+ # the PO file containing the translations.
428
+ module_name = @forge_name ? @forge_name.gsub("/", "-") : name
429
+ return if Puppet::GettextConfig.translations_loaded?(module_name)
428
430
 
429
431
  locales_path = File.absolute_path('locales', path)
430
432
 
431
- if Puppet::GettextConfig.initialize(locales_path, :po)
432
- Puppet.debug "#{module_name} initialized for i18n: #{GettextSetup.translation_repositories[module_name]}"
433
- else if Puppet::GettextConfig.gettext_loaded?
434
- config_path = File.absolute_path('config.yaml', locales_path)
435
- Puppet.debug "Could not find locales configuration file for #{module_name} at #{config_path}. Skipping i18n initialization."
433
+ if Puppet::GettextConfig.load_translations(module_name, locales_path, :po)
434
+ Puppet.debug "i18n initialized for #{module_name}"
435
+ elsif Puppet::GettextConfig.gettext_loaded?
436
+ Puppet.debug "Could not find translation files for #{module_name} at #{locales_path}. Skipping i18n initialization."
436
437
  else
437
- Puppet.debug "No gettext library found, skipping i18n initialization."
438
- end
438
+ Puppet.debug "No gettext library found, skipping i18n initialization."
439
439
  end
440
440
  end
441
441
 
442
442
  private
443
443
 
444
- def i18n_initialized?(module_name)
445
- if Puppet::GettextConfig.gettext_loaded?
446
- GettextSetup.translation_repositories.has_key? module_name
447
- else
448
- # GettextSetup not yet initialized or not found
449
- false
450
- end
451
- end
452
-
453
444
  def wanted_manifests_from(pattern)
454
445
  begin
455
446
  extended = File.extname(pattern).empty? ? "#{pattern}.pp" : pattern
@@ -2,8 +2,15 @@ require 'base64'
2
2
  module Puppet::Pops
3
3
  module Types
4
4
 
5
- # A Puppet Language Type that exposes the {{SemanticPuppet::Version}} and {{SemanticPuppet::VersionRange}}.
6
- # The version type is parameterized with version ranges.
5
+ # A Puppet Language Type that represents binary data content (a sequence of 8-bit bytes).
6
+ # Instances of this data type can be created from `String` and `Array[Integer[0,255]]`
7
+ # values. Also see the `binary_file` function for reading binary content from a file.
8
+ #
9
+ # A `Binary` can be converted to `String` and `Array` form - see function `new` for
10
+ # the respective target data type for more information.
11
+ #
12
+ # Instances of this data type serialize as base 64 encoded strings when the serialization
13
+ # format is textual, and as binary content when a serialization format supports this.
7
14
  #
8
15
  # @api public
9
16
  class PBinaryType < PAnyType
@@ -228,10 +228,10 @@ class PObjectType < PMetaType
228
228
  # TODO: Assumes Ruby implementation for now
229
229
  if(callable_type.is_a?(PVariantType))
230
230
  callable_type.types.map do |ct|
231
- Functions::Dispatch.new(ct, name, [], false, ct.block_type.nil? ? nil : 'block')
231
+ Functions::Dispatch.new(ct, RubyGenerator.protect_reserved_name(name), [], false, ct.block_type.nil? ? nil : 'block')
232
232
  end
233
233
  else
234
- [Functions::Dispatch.new(callable_type, name, [], false, callable_type.block_type.nil? ? nil : 'block')]
234
+ [Functions::Dispatch.new(callable_type, RubyGenerator.protect_reserved_name(name), [], false, callable_type.block_type.nil? ? nil : 'block')]
235
235
  end
236
236
  end
237
237
 
@@ -544,7 +544,13 @@ class PObjectType < PMetaType
544
544
  init_non_opt_count = 0
545
545
  init_param_names = init.parameters.map do |p|
546
546
  init_non_opt_count += 1 if :req == p[0]
547
- p[1].to_s
547
+ n = p[1].to_s
548
+ r = RubyGenerator.unprotect_reserved_name(n)
549
+ unless r.equal?(n)
550
+ # assert that the protected name wasn't a real name (names can start with underscore)
551
+ n = r unless param_names.index(r).nil?
552
+ end
553
+ n
548
554
  end
549
555
 
550
556
  if init_param_names != param_names