Created
January 17, 2017 05:06
-
-
Save Dessix/9f07083622658dcdd75e8573e9e47752 to your computer and use it in GitHub Desktop.
Fable - Compiled output when using abstract types - https://github.com/fable-compiler/Fable/issues/654
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports.AbstractTypeExtended$2E$get_prop = exports.TypeModule = undefined; | |
var _Symbol2 = require("fable-core/umd/Symbol"); | |
var _Symbol3 = _interopRequireDefault(_Symbol2); | |
var _Util = require("fable-core/umd/Util"); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
const TypeModule = exports.TypeModule = function (__exports) { | |
const AbstractType = __exports.AbstractType = class AbstractType { | |
[_Symbol3.default.reflection]() { | |
return { | |
type: "Main.TypeModule.AbstractType", | |
properties: { | |
Item: (0, _Util.Option)("number"), | |
prop: "number", | |
propInline: "number" | |
} | |
}; | |
} | |
get prop() { | |
return 4; | |
} | |
}; | |
(0, _Symbol2.setType)("Main.TypeModule.AbstractType", AbstractType); | |
return __exports; | |
}({}); | |
function AbstractTypeExtended_get_prop() { | |
return 4; | |
} | |
exports.AbstractTypeExtended$2E$get_prop = AbstractTypeExtended_get_prop; | |
(function (args) { | |
const protoA = { | |
prop: 9, | |
propInline: 9.5 | |
}; | |
const a = protoA; | |
if (a.prop !== 9) { | |
throw new Error("Direct dynamic access should hit \"prop\" by name"); | |
} | |
if (a["prop"] !== 9) { | |
throw new Error("Direct dynamic access should hit \"prop\" by name"); | |
} | |
if (a.prop !== 4) { | |
throw new Error("Access by extension property should hit property by FSharp typing, not by name on the type"); | |
} | |
if (6 !== 6) { | |
throw new Error("Access by inline extension property should hit property by static type"); | |
} | |
const a_ = protoA; | |
if (a.prop !== 9) { | |
throw new Error("Direct dynamic access should hit \"prop\" by name"); | |
} | |
if (a["prop"] !== 9) { | |
throw new Error("Direct dynamic access should hit \"prop\" by name"); | |
} | |
if (AbstractTypeExtended_get_prop.bind(a_)() !== 4) { | |
throw new Error("Access by extension property should hit property by FSharp typing, not by name on the type"); | |
} | |
if (6 !== 6) { | |
throw new Error("Access by inline extension property should hit property by static type"); | |
} | |
return 0; | |
})(process.argv.slice(2)); | |
//# sourceMappingURL=Main.js.map |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment