From bc95c93bd42c997c723d400e62ffde35c0856cc9 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Thu, 13 Feb 2025 08:58:18 -0800 Subject: [PATCH 1/2] Fix `@example` validation (#6003) fix #5999 This is not really a great solution but is bascially teh same as it was with projections --- packages/compiler/src/lib/decorators.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/compiler/src/lib/decorators.ts b/packages/compiler/src/lib/decorators.ts index 4cdb26e1ff..42639c9686 100644 --- a/packages/compiler/src/lib/decorators.ts +++ b/packages/compiler/src/lib/decorators.ts @@ -100,6 +100,7 @@ import { UnionVariant, Value, } from "../core/types.js"; +import { Realm } from "../experimental/realm.js"; import { useStateMap, useStateSet } from "../utils/index.js"; import { setKey } from "./key.js"; import { createStateSymbol, filterModelPropertiesInPlace } from "./utils.js"; @@ -1300,7 +1301,7 @@ export const $example: ExampleDecorator = ( compilerAssert(decorator, `Couldn't find @example decorator`, context.decoratorTarget); const rawExample = decorator.args[0].value as Value; // skip validation in projections - if (target.projectionBase === undefined) { + if (target.projectionBase === undefined && Realm.realmForType.get(target) === undefined) { if ( !checkExampleValid( context.program, From 5c6cd619903219d3bcba12e9d304c1586a1aa049 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Thu, 13 Feb 2025 09:37:00 -0800 Subject: [PATCH 2/2] Bump compiler for 0.65.2 hotfix (#6004) --- packages/compiler/CHANGELOG.md | 7 +++++++ packages/compiler/package.json | 2 +- packages/compiler/templates/scaffolding.json | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/compiler/CHANGELOG.md b/packages/compiler/CHANGELOG.md index a1b2258bda..a8f0e76cc3 100644 --- a/packages/compiler/CHANGELOG.md +++ b/packages/compiler/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log - @typespec/compiler +## 0.65.2 + +### Bug Fixes + +- [#6003](https://github.com/microsoft/typespec/pull/6003) Fix regression where enum values would report not being assignable to their enum when using versioning + + ## 0.65.1 ### Bug Fixes diff --git a/packages/compiler/package.json b/packages/compiler/package.json index 6e1261c241..5f4ffa1899 100644 --- a/packages/compiler/package.json +++ b/packages/compiler/package.json @@ -1,6 +1,6 @@ { "name": "@typespec/compiler", - "version": "0.65.1", + "version": "0.65.2", "description": "TypeSpec Compiler Preview", "author": "Microsoft Corporation", "license": "MIT", diff --git a/packages/compiler/templates/scaffolding.json b/packages/compiler/templates/scaffolding.json index 1cead52361..74957a99dd 100644 --- a/packages/compiler/templates/scaffolding.json +++ b/packages/compiler/templates/scaffolding.json @@ -3,12 +3,12 @@ "title": "Empty project", "description": "Create an empty project.", "libraries": [], - "compilerVersion": "0.65.1" + "compilerVersion": "0.65.2" }, "rest": { "title": "Generic REST API", "description": "Create a project representing a generic REST API", - "compilerVersion": "0.65.1", + "compilerVersion": "0.65.2", "libraries": [ "@typespec/http", "@typespec/rest", @@ -69,7 +69,7 @@ "library-ts": { "title": "TypeSpec Library (With TypeScript)", "description": "Create a new package to add decorators or linters to typespec.", - "compilerVersion": "0.65.1", + "compilerVersion": "0.65.2", "libraries": [], "files": [ { @@ -145,7 +145,7 @@ "emitter-ts": { "title": "TypeSpec Emitter (With TypeScript)", "description": "Create a new package that will be emitting typespec", - "compilerVersion": "0.65.1", + "compilerVersion": "0.65.2", "libraries": [], "files": [ {