> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 型の変換

> FlexiLayout language における型の暗黙的な変換。Int から Real へのような安全な変換に加え、コンパイラ警告を伴う座標と距離の変換について説明します。

FlexiLayout language は、型の暗黙的な変換をサポートしています。一部の変換は常に安全ですが、許可されていてもランタイム時に失敗し、コンパイラが警告を表示することがある変換もあります。

<div id="safe-implicit-conversions">
  ## 安全な暗黙的変換
</div>

次の変換は常に安全です。

| 変換元の型         | 変換先の型          |
| :------------ | :------------- |
| `Int`         | `Real`         |
| `Rect`        | `Region`       |
| `XCoordinate` | `XInterval`    |
| `YCoordinate` | `YInterval`    |
| `Distance`    | `DistInterval` |

<div id="conversions-that-may-cause-errors">
  ## エラーの原因となる可能性がある変換
</div>

次の変換は許可されていますが、ランタイム エラーが発生する可能性があります。たとえば、`XCoordinate` を `Distance` に変換し、さらに `Distance` を `YCoordinate` に変換すると、X 座標が誤って Y 座標に変換されることがあります。

これらの変換のいずれかを使用すると、コンパイラは警告を表示します。

| 変換元の型          | 変換先の型          |
| :------------- | :------------- |
| `Distance`     | `XCoordinate`  |
| `Distance`     | `YCoordinate`  |
| `XCoordinate`  | `Distance`     |
| `YCoordinate`  | `Distance`     |
| `DistInterval` | `XInterval`    |
| `DistInterval` | `YInterval`    |
| `Xinterval`    | `DistInterval` |
| `Yinterval`    | `DistInterval` |
