diff --git a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php
index 64e4941..64786a8 100644
--- a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php
+++ b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php
@@ -33,8 +33,23 @@ public function parse($filename) {
       if (!empty($missing_keys)) {
         throw new InfoParserException('Missing required keys (' . implode(', ', $missing_keys) . ') in ' . $filename);
       }
-      if (isset($parsed_info['version']) && $parsed_info['version'] === 'VERSION') {
-        $parsed_info['version'] = \Drupal::VERSION;
+      if (isset($parsed_info['version'])) {
+        if ($parsed_info['version'] === 'VERSION') {
+          $parsed_info['version'] = $this->getDrupalVersion();
+        }
+        elseif (strpos($parsed_info['version'], 'VERSION-') === 0) {
+          $drupal_version = $this->getDrupalVersion();
+          list($version, ) = explode('-', $drupal_version);
+          $version = $version . substr($parsed_info['version'], 7);
+          // If the stability version of Drupal core is lower, use its version.
+          // Therefore if core's version is 8.1.x-alpha and the module's version
+          // is VERSION-beta in the info.yml file the displayed version with be
+          // 8.1.x-alpha.
+          if (version_compare($drupal_version, $version) < 0) {
+            $version = $drupal_version;
+          }
+          $parsed_info['version'] = $version;
+        }
       }
     }
     return $parsed_info;
@@ -50,4 +65,14 @@ protected function getRequiredKeys() {
     return array('type', 'core', 'name');
   }
 
+  /**
+   * Gets the current Drupal version.
+   *
+   * @return string
+   *   The current Drupal version.
+   */
+  protected function getDrupalVersion() {
+    return \Drupal::VERSION;
+  }
+
 }
diff --git a/core/modules/inline_form_errors/inline_form_errors.info.yml b/core/modules/inline_form_errors/inline_form_errors.info.yml
index a5949fa..ecb0a29 100644
--- a/core/modules/inline_form_errors/inline_form_errors.info.yml
+++ b/core/modules/inline_form_errors/inline_form_errors.info.yml
@@ -1,6 +1,6 @@
 type: module
 name: Inline Form Errors
 description: 'Enables inline form errors.'
-version: VERSION
+version: VERSION-unstable
 core: 8.x
 package: Core (Experimental)
diff --git a/core/modules/migrate/migrate.info.yml b/core/modules/migrate/migrate.info.yml
index 51bd5b0..e6bfff7 100644
--- a/core/modules/migrate/migrate.info.yml
+++ b/core/modules/migrate/migrate.info.yml
@@ -2,5 +2,5 @@ name: Migrate
 type: module
 description: 'Handles migrations'
 package: Core (Experimental)
-version: VERSION
+version: VERSION-beta
 core: 8.x
diff --git a/core/modules/migrate_drupal/migrate_drupal.info.yml b/core/modules/migrate_drupal/migrate_drupal.info.yml
index f2e7272..b4263f2 100644
--- a/core/modules/migrate_drupal/migrate_drupal.info.yml
+++ b/core/modules/migrate_drupal/migrate_drupal.info.yml
@@ -2,7 +2,7 @@ name: Migrate Drupal
 type: module
 description: 'Contains migrations from older Drupal versions.'
 package: Core (Experimental)
-version: VERSION
+version: VERSION-alpha
 core: 8.x
 dependencies:
   - migrate
diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserDynamicTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserDynamicTest.php
new file mode 100644
index 0000000..8ff54df
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserDynamicTest.php
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Extension\InfoParserDynamicTest.
+ */
+
+namespace Drupal\Tests\Core\Extension;
+
+use Drupal\Core\Extension\InfoParserDynamic;
+use Drupal\Tests\UnitTestCase;
+use org\bovigo\vfs\vfsStream;
+
+/**
+ * Tests InfoParserDynamic class.
+ *
+ * @coversDefaultClass \Drupal\Core\Extension\InfoParserDynamic
+ *
+ * @group Extension
+ */
+class InfoParserUnitTest extends UnitTestCase {
+
+  /**
+   * Tests VERSION replacement.
+   *
+   * @covers ::parse
+   * @dataProvider versionReplacementProvider
+   */
+  public function testVersionReplacement($module_version, $drupal_version, $expected) {
+    // It is not possible to use reflection to change constants. Mock
+    // InfoParserDynamic::getDrupalVersion() in order to properly test version
+    // replacement.
+    $info_parser = $this->getMockBuilder(InfoParserDynamic::class)->setMethods(['getDrupalVersion'])->getMock();
+    $info_parser->method('getDrupalVersion')->willReturn($drupal_version);
+
+    $info_file_contents = <<<COMMONTEST
+core: 8.x
+name: common_test
+type: module
+description: 'testing info file parsing'
+simple_string: 'A simple string'
+version: "$module_version"
+double_colon: dummyClassName::
+COMMONTEST;
+
+    vfsStream::setup('modules');
+    vfsStream::create([
+      'fixtures' => [
+        'common_test.info.yml' => $info_file_contents,
+      ],
+    ]);
+
+    $info_values = $info_parser->parse(vfsStream::url('modules/fixtures/common_test.info.yml'));
+    $this->assertEquals($expected, $info_values['version']);
+  }
+
+  /**
+   * Data provider for self::testVersionReplacement().
+   */
+  public function versionReplacementProvider() {
+    return [
+      ['VERSION-dev', '8.0.x-beta12', '8.0.x-dev'],
+      ['VERSION-beta', '8.2.0', '8.2.0-beta'],
+      ['VERSION', '8.5.0', '8.5.0'],
+      // If the stability version of Drupal core is lower then it is used.
+      ['VERSION-beta', '8.2.0-alpha', '8.2.0-alpha'],
+      ['Blah VERSION', '8.1.0-rc2', 'Blah VERSION'],
+      ['Blah VERSION-rc', '8.1.0-rc2', 'Blah VERSION-rc'],
+    ];
+  }
+
+}
