1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2021 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 esid: sec-temporal.plainmonthday.prototype.toplaindate
8 with() should throw a TypeError if mergeFields() returns a primitive,
9 without passing the value on to any other calendar methods
10 includes: [compareArray.js, temporalHelpers.js]
11 features: [BigInt, Symbol, Temporal]
14 [undefined, null, true, 3.14159, "bad value", Symbol("no"), 7n].forEach((primitive) => {
15 const calendar = TemporalHelpers.calendarMergeFieldsReturnsPrimitive(primitive);
16 const instance = new Temporal.PlainMonthDay(5, 2, calendar);
17 assert.throws(TypeError, () => instance.toPlainDate({ year: 2005 }), "bad return from mergeFields() throws");
18 assert.sameValue(calendar.dateFromFieldsCallCount, 0, "dateFromFields() never called");